@uzum-tech/ui 2.4.6 → 2.4.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (72) hide show
  1. package/dist/index.js +320 -91
  2. package/dist/index.mjs +320 -91
  3. package/dist/index.prod.js +2 -2
  4. package/dist/index.prod.mjs +3 -3
  5. package/es/chat/src/styles/index.cssr.mjs +1 -1
  6. package/es/components.d.ts +99 -10
  7. package/es/dynamic-tags/index.d.ts +3 -3
  8. package/es/dynamic-tags/index.mjs +2 -1
  9. package/es/dynamic-tags/src/DynamicTags.d.ts +74 -1177
  10. package/es/dynamic-tags/src/DynamicTags.mjs +150 -107
  11. package/es/dynamic-tags/src/interface.d.ts +1146 -6
  12. package/es/dynamic-tags/src/interface.mjs +34 -1
  13. package/es/dynamic-tags/src/styles/index.cssr.mjs +35 -3
  14. package/es/dynamic-tags/styles/dark.mjs +4 -2
  15. package/es/dynamic-tags/styles/light.d.ts +2 -0
  16. package/es/dynamic-tags/styles/light.mjs +4 -2
  17. package/es/editor/index.d.ts +1 -1
  18. package/es/editor/src/Editor.d.ts +21 -0
  19. package/es/editor/src/Editor.mjs +5 -2
  20. package/es/editor/src/EditorParts/EditorContent/EditorContent.d.ts +27 -0
  21. package/es/editor/src/EditorParts/EditorContent/EditorContent.mjs +37 -3
  22. package/es/editor/src/EditorParts/EditorContent/interface.d.ts +11 -0
  23. package/es/editor/src/EditorParts/EditorContent/interface.mjs +2 -0
  24. package/es/editor/src/EditorParts/EditorToolbar/EditorToolbar.d.ts +18 -0
  25. package/es/editor/src/EditorParts/EditorToolbar/interface.d.ts +9 -0
  26. package/es/editor/src/composables/use-editor-css-vars.mjs +8 -2
  27. package/es/editor/src/extensions.d.ts +2 -1
  28. package/es/editor/src/extensions.mjs +34 -4
  29. package/es/editor/src/interface.d.ts +22 -2
  30. package/es/editor/src/interface.mjs +1 -0
  31. package/es/editor/src/styles/index.cssr.mjs +21 -4
  32. package/es/editor/styles/dark.d.ts +3 -0
  33. package/es/editor/styles/light.d.ts +6 -0
  34. package/es/editor/styles/light.mjs +6 -1
  35. package/es/message-bubble/src/styles/index.cssr.mjs +1 -1
  36. package/es/version.d.ts +1 -1
  37. package/es/version.mjs +1 -1
  38. package/lib/chat/src/styles/index.cssr.js +1 -1
  39. package/lib/components.d.ts +99 -10
  40. package/lib/dynamic-tags/index.d.ts +3 -3
  41. package/lib/dynamic-tags/index.js +3 -2
  42. package/lib/dynamic-tags/src/DynamicTags.d.ts +74 -1177
  43. package/lib/dynamic-tags/src/DynamicTags.js +142 -77
  44. package/lib/dynamic-tags/src/interface.d.ts +1146 -6
  45. package/lib/dynamic-tags/src/interface.js +24 -0
  46. package/lib/dynamic-tags/src/styles/index.cssr.js +34 -2
  47. package/lib/dynamic-tags/styles/dark.js +4 -2
  48. package/lib/dynamic-tags/styles/light.d.ts +2 -0
  49. package/lib/dynamic-tags/styles/light.js +4 -2
  50. package/lib/editor/index.d.ts +1 -1
  51. package/lib/editor/src/Editor.d.ts +21 -0
  52. package/lib/editor/src/Editor.js +4 -2
  53. package/lib/editor/src/EditorParts/EditorContent/EditorContent.d.ts +27 -0
  54. package/lib/editor/src/EditorParts/EditorContent/EditorContent.js +30 -3
  55. package/lib/editor/src/EditorParts/EditorContent/interface.d.ts +11 -0
  56. package/lib/editor/src/EditorParts/EditorContent/interface.js +1 -1
  57. package/lib/editor/src/EditorParts/EditorToolbar/EditorToolbar.d.ts +18 -0
  58. package/lib/editor/src/EditorParts/EditorToolbar/interface.d.ts +9 -0
  59. package/lib/editor/src/composables/use-editor-css-vars.js +5 -2
  60. package/lib/editor/src/extensions.d.ts +2 -1
  61. package/lib/editor/src/extensions.js +41 -5
  62. package/lib/editor/src/interface.d.ts +22 -2
  63. package/lib/editor/src/interface.js +1 -1
  64. package/lib/editor/src/styles/index.cssr.js +21 -4
  65. package/lib/editor/styles/dark.d.ts +3 -0
  66. package/lib/editor/styles/light.d.ts +6 -0
  67. package/lib/editor/styles/light.js +5 -2
  68. package/lib/message-bubble/src/styles/index.cssr.js +1 -1
  69. package/lib/version.d.ts +1 -1
  70. package/lib/version.js +1 -1
  71. package/package.json +1 -1
  72. package/web-types.json +31 -2
package/dist/index.js CHANGED
@@ -54507,9 +54507,11 @@
54507
54507
  Tag: tagDark,
54508
54508
  Space: spaceDark
54509
54509
  },
54510
- self() {
54510
+ self(vars) {
54511
54511
  return {
54512
- inputWidth: "64px"
54512
+ inputWidth: "64px",
54513
+ draggingOpacity: "0.5",
54514
+ dropIndicatorColor: vars.elementsPrimary
54513
54515
  };
54514
54516
  }
54515
54517
  };
@@ -54523,9 +54525,11 @@
54523
54525
  Tag: tagLight,
54524
54526
  Space: spaceLight
54525
54527
  },
54526
- self() {
54528
+ self(vars) {
54527
54529
  return {
54528
- inputWidth: "64px"
54530
+ inputWidth: "64px",
54531
+ draggingOpacity: "0.5",
54532
+ dropIndicatorColor: vars.elementsPrimary
54529
54533
  };
54530
54534
  }
54531
54535
  });
@@ -54542,6 +54546,8 @@
54542
54546
  lineHeightTitleSmall,
54543
54547
  lineHeightBodyLarge,
54544
54548
  lineHeightBodyMedium,
54549
+ fontBodySmall,
54550
+ lineHeightBodySmall,
54545
54551
  surfacePrimary,
54546
54552
  elementsQuaternary,
54547
54553
  elementsQuinary,
@@ -54598,7 +54604,10 @@
54598
54604
  markdownH1LineHeight: lineHeightTitleMedium,
54599
54605
  markdownH2LineHeight: lineHeightTitleSmall,
54600
54606
  markdownH3LineHeight: lineHeightBodyLarge,
54601
- markdownTextLineHeight: lineHeightBodyMedium
54607
+ markdownTextLineHeight: lineHeightBodyMedium,
54608
+ countTextColor: textTertiary,
54609
+ countFontSize: fontBodySmall,
54610
+ countLineHeight: lineHeightBodySmall
54602
54611
  };
54603
54612
  }
54604
54613
  const editorLight = createTheme$1({
@@ -60869,7 +60878,7 @@
60869
60878
  border-radius: var(--u-message-bubble-border-radius);
60870
60879
  font-size: 14px;
60871
60880
  line-height: 20px;
60872
- word-wrap: break-word;
60881
+ overflow-wrap: anywhere;
60873
60882
  background-color: var(--u-message-bubble-background-color-other);
60874
60883
  color: var(--u-message-bubble-text-color-other);
60875
60884
  border-bottom-left-radius: 6px;
@@ -61954,7 +61963,7 @@
61954
61963
  border-radius: 18px;
61955
61964
  font-size: 14px;
61956
61965
  line-height: 20px;
61957
- word-wrap: break-word;
61966
+ overflow-wrap: anywhere;
61958
61967
  background-color: var(--u-message-bubble-background-color-other);
61959
61968
  color: var(--u-message-bubble-text-color-other);
61960
61969
  border-bottom-left-radius: 6px;
@@ -82948,7 +82957,10 @@ img.ProseMirror-separator {
82948
82957
  markdownH1LineHeight,
82949
82958
  markdownH2LineHeight,
82950
82959
  markdownH3LineHeight,
82951
- markdownTextLineHeight
82960
+ markdownTextLineHeight,
82961
+ countTextColor,
82962
+ countFontSize,
82963
+ countLineHeight
82952
82964
  } = themeVarsRef.value;
82953
82965
  return {
82954
82966
  "--u-bezier": cubicBezierEaseInOut,
@@ -82988,7 +83000,10 @@ img.ProseMirror-separator {
82988
83000
  "--u-editor-markdown-h1-line-height": markdownH1LineHeight,
82989
83001
  "--u-editor-markdown-h2-line-height": markdownH2LineHeight,
82990
83002
  "--u-editor-markdown-h3-line-height": markdownH3LineHeight,
82991
- "--u-editor-markdown-text-line-height": markdownTextLineHeight
83003
+ "--u-editor-markdown-text-line-height": markdownTextLineHeight,
83004
+ "--u-editor-count-text-color": countTextColor,
83005
+ "--u-editor-count-font-size": countFontSize,
83006
+ "--u-editor-count-line-height": countLineHeight
82992
83007
  };
82993
83008
  });
82994
83009
  }
@@ -83028,6 +83043,7 @@ img.ProseMirror-separator {
83028
83043
  autofocus: Boolean,
83029
83044
  maxLength: Number,
83030
83045
  maxRows: Number,
83046
+ showCount: Boolean,
83031
83047
  toolbarButtonProps: Object,
83032
83048
  toolbarIconProps: Object,
83033
83049
  toolbarDropdownProps: Object,
@@ -83063,7 +83079,11 @@ img.ProseMirror-separator {
83063
83079
  margin: 0;
83064
83080
  `), cE("toolbar-block-type", `
83065
83081
  width: 71px;
83066
- `)]), cE("content-wrapper", `
83082
+ `)]), cE("body", `
83083
+ display: flex;
83084
+ flex-direction: column;
83085
+ gap: 4px;
83086
+ `), cE("content-wrapper", `
83067
83087
  position: relative;
83068
83088
  box-sizing: border-box;
83069
83089
  display: flex;
@@ -83085,7 +83105,14 @@ img.ProseMirror-separator {
83085
83105
  right: 6px;
83086
83106
  top: 6px;
83087
83107
  flex-shrink: 0;
83088
- `)]), cE("content", `
83108
+ `)]), cE("count", `
83109
+ align-self: flex-end;
83110
+ font-size: var(--u-editor-count-font-size);
83111
+ line-height: var(--u-editor-count-line-height);
83112
+ color: var(--u-editor-count-text-color);
83113
+ white-space: nowrap;
83114
+ padding-right: 10px;
83115
+ `), cE("content", `
83089
83116
  white-space: normal;
83090
83117
  width: 100%;
83091
83118
  min-width: 0;
@@ -83093,7 +83120,7 @@ img.ProseMirror-separator {
83093
83120
  color: var(--u-editor-content-text-color);
83094
83121
  font-size: var(--u-editor-markdown-text-font-size);
83095
83122
  line-height: var(--u-editor-markdown-text-line-height);
83096
- word-wrap: break-word;
83123
+ overflow-wrap: anywhere;
83097
83124
  `, [cM("scrollable", `
83098
83125
  overflow-y: auto;
83099
83126
  scrollbar-width: none;
@@ -83101,7 +83128,10 @@ img.ProseMirror-separator {
83101
83128
  width: 0;
83102
83129
  height: 0;
83103
83130
  display: none;
83104
- `)]), cE("editable", "outline: none;", [c$1(".is-editor-empty:first-child::before", `
83131
+ `)]), cE("editable", `
83132
+ outline: none;
83133
+ overflow-wrap: anywhere;
83134
+ `, [c$1(".is-editor-empty:first-child::before", `
83105
83135
  content: attr(data-placeholder);
83106
83136
  float: left;
83107
83137
  height: 0;
@@ -83192,6 +83222,8 @@ img.ProseMirror-separator {
83192
83222
  },
83193
83223
  sendDisabled: Boolean,
83194
83224
  maxRows: Number,
83225
+ showCount: Boolean,
83226
+ maxLength: Number,
83195
83227
  sendTooltip: String,
83196
83228
  disabled: Boolean,
83197
83229
  sendButtonProps: Object,
@@ -83227,6 +83259,7 @@ img.ProseMirror-separator {
83227
83259
  const sendButtonThemeOverridesRef = vue.computed(() => createSendButtonThemeOverrides(themeVarsRef.value));
83228
83260
  const scrollbarInstRef = vue.ref(null);
83229
83261
  const contentInstRef = vue.ref(null);
83262
+ const characterCountRef = vue.ref(0);
83230
83263
  const mergedMaxRowsRef = vue.computed(
83231
83264
  () => UEditor?.maxRowsRef.value ?? props.maxRows
83232
83265
  );
@@ -83245,18 +83278,27 @@ img.ProseMirror-separator {
83245
83278
  function syncScrollbar() {
83246
83279
  scrollbarInstRef.value?.syncUnifiedContainer();
83247
83280
  }
83281
+ function syncCharacterCount() {
83282
+ characterCountRef.value = editorInstanceRef.value?.storage.characterCount?.characters() ?? 0;
83283
+ }
83284
+ function handleTransaction({ transaction }) {
83285
+ syncScrollbar();
83286
+ if (transaction.docChanged)
83287
+ syncCharacterCount();
83288
+ }
83248
83289
  function unsubscribe() {
83249
- subscribed?.off("transaction", syncScrollbar);
83290
+ subscribed?.off("transaction", handleTransaction);
83250
83291
  subscribed = void 0;
83251
83292
  }
83252
83293
  vue.watch(
83253
83294
  editorInstanceRef,
83254
83295
  (editor) => {
83255
83296
  unsubscribe();
83297
+ syncCharacterCount();
83256
83298
  if (!editor)
83257
83299
  return;
83258
83300
  subscribed = editor;
83259
- editor.on("transaction", syncScrollbar);
83301
+ editor.on("transaction", handleTransaction);
83260
83302
  },
83261
83303
  { immediate: true }
83262
83304
  );
@@ -83295,6 +83337,16 @@ img.ProseMirror-separator {
83295
83337
  mergedContentProps: vue.computed(
83296
83338
  () => UEditor?.contentPropsRef.value ?? props.contentProps
83297
83339
  ),
83340
+ mergedShowCount: vue.computed(
83341
+ () => UEditor?.showCountRef.value ?? props.showCount
83342
+ ),
83343
+ mergedMaxLength: vue.computed(
83344
+ () => UEditor?.maxLengthRef.value ?? props.maxLength
83345
+ ),
83346
+ countAvailable: vue.computed(
83347
+ () => !!editorInstanceRef.value?.storage.characterCount
83348
+ ),
83349
+ characterCount: characterCountRef,
83298
83350
  scrollbarInstRef,
83299
83351
  contentInstRef,
83300
83352
  mergedMaxRows: mergedMaxRowsRef,
@@ -83306,7 +83358,7 @@ img.ProseMirror-separator {
83306
83358
  },
83307
83359
  render() {
83308
83360
  this.onRender?.();
83309
- const content = /* @__PURE__ */ vue.h(
83361
+ const contentWrapper = /* @__PURE__ */ vue.h(
83310
83362
  "div",
83311
83363
  {
83312
83364
  class: [
@@ -83352,6 +83404,16 @@ img.ProseMirror-separator {
83352
83404
  { icon: this.$slots.sendIcon }
83353
83405
  )
83354
83406
  );
83407
+ const content = this.mergedShowCount ? /* @__PURE__ */ vue.h("div", { class: `${this.mergedClsPrefix}-editor__body` }, contentWrapper, this.countAvailable && /* @__PURE__ */ vue.h("span", { class: `${this.mergedClsPrefix}-editor__count` }, resolveSlotWithProps(
83408
+ this.$slots.count,
83409
+ {
83410
+ count: this.characterCount,
83411
+ maxLength: this.mergedMaxLength
83412
+ },
83413
+ () => [
83414
+ this.mergedMaxLength === void 0 ? this.characterCount : `${this.characterCount} / ${this.mergedMaxLength}`
83415
+ ]
83416
+ ))) : contentWrapper;
83355
83417
  if (!this.isStandalone)
83356
83418
  return content;
83357
83419
  return /* @__PURE__ */ vue.h(
@@ -93300,6 +93362,36 @@ img.ProseMirror-separator {
93300
93362
  }];
93301
93363
  }
93302
93364
  });
93365
+ const CharacterLimit = Extension.create({
93366
+ name: "characterLimit",
93367
+ addOptions: () => ({
93368
+ getLimit: () => void 0
93369
+ }),
93370
+ addProseMirrorPlugins() {
93371
+ const {
93372
+ getLimit
93373
+ } = this.options;
93374
+ const count = node => this.editor.storage.characterCount.characters({
93375
+ node
93376
+ });
93377
+ return [new Plugin({
93378
+ filterTransaction: (transaction, state) => {
93379
+ const limit = getLimit();
93380
+ if (!transaction.docChanged || transaction.getMeta("preventUpdate") || !limit) {
93381
+ return true;
93382
+ }
93383
+ const oldSize = count(state.doc);
93384
+ const newSize = count(transaction.doc);
93385
+ if (newSize <= limit) return true;
93386
+ if (oldSize > limit) return newSize <= oldSize;
93387
+ if (!transaction.getMeta("paste")) return false;
93388
+ const pos = transaction.selection.$head.pos;
93389
+ transaction.deleteRange(pos - (newSize - limit), pos);
93390
+ return count(transaction.doc) <= limit;
93391
+ }
93392
+ })];
93393
+ }
93394
+ });
93303
93395
  const SendShortcut = Extension.create({
93304
93396
  name: "sendShortcut",
93305
93397
  priority: 1e3,
@@ -93355,7 +93447,7 @@ img.ProseMirror-separator {
93355
93447
  }
93356
93448
  const single = document.childCount === 1 && document.firstChild?.type.name === "paragraph";
93357
93449
  const slice = single ? new Slice(document.content, 1, 1) : new Slice(document.content, 0, 0);
93358
- view.dispatch(view.state.tr.replaceSelection(slice).scrollIntoView());
93450
+ view.dispatch(view.state.tr.replaceSelection(slice).scrollIntoView().setMeta("paste", true).setMeta("uiEvent", "paste"));
93359
93451
  return true;
93360
93452
  }
93361
93453
  }
@@ -93402,9 +93494,9 @@ img.ProseMirror-separator {
93402
93494
  }
93403
93495
  }), Placeholder.configure({
93404
93496
  placeholder
93405
- }), ...(maxLength === void 0 ? [] : [CharacterCount.configure({
93406
- limit: maxLength
93407
- })]), MarkdownSource, MarkdownPaste.configure({
93497
+ }), CharacterCount, CharacterLimit.configure({
93498
+ getLimit: typeof maxLength === "function" ? maxLength : () => maxLength
93499
+ }), MarkdownSource, MarkdownPaste.configure({
93408
93500
  markdownOptions
93409
93501
  }), ...(onSendShortcut ? [SendShortcut.configure({
93410
93502
  onSend: onSendShortcut
@@ -93510,7 +93602,7 @@ img.ProseMirror-separator {
93510
93602
  markdownOptions: props.markdownOptions,
93511
93603
  extensions: props.extensions,
93512
93604
  nodeProps: props.nodeProps,
93513
- maxLength: props.maxLength,
93605
+ maxLength: () => props.maxLength,
93514
93606
  onSendShortcut: props.sendOnEnter ? handleSend : void 0
93515
93607
  }),
93516
93608
  editable: editableRef.value,
@@ -93658,6 +93750,8 @@ img.ProseMirror-separator {
93658
93750
  contentPropsRef: vue.toRef(props, "contentProps"),
93659
93751
  maxRowsRef: vue.toRef(props, "maxRows"),
93660
93752
  showSendButtonRef: vue.toRef(props, "showSendButton"),
93753
+ showCountRef: vue.toRef(props, "showCount"),
93754
+ maxLengthRef: vue.toRef(props, "maxLength"),
93661
93755
  sendDisabledRef,
93662
93756
  sendTooltipRef: mergedSendTooltipRef,
93663
93757
  disabledRef: vue.toRef(props, "disabled"),
@@ -93693,7 +93787,7 @@ img.ProseMirror-separator {
93693
93787
  style: this.inlineThemeDisabled ? void 0 : this.cssVars
93694
93788
  },
93695
93789
  this.$slots.toolbar?.() ?? /* @__PURE__ */ vue.h(_UEditorToolbar, null),
93696
- this.$slots.content?.() ?? /* @__PURE__ */ vue.h(_UEditorContent, null, { sendIcon: this.$slots.sendIcon })
93790
+ this.$slots.content?.() ?? /* @__PURE__ */ vue.h(_UEditorContent, null, { sendIcon: this.$slots.sendIcon, count: this.$slots.count })
93697
93791
  );
93698
93792
  }
93699
93793
  });
@@ -124355,10 +124449,6 @@ img.ProseMirror-separator {
124355
124449
  }
124356
124450
  });
124357
124451
 
124358
- var style$M = cB("dynamic-tags", [cB("input", {
124359
- minWidth: "var(--u-input-width)"
124360
- })]);
124361
-
124362
124452
  const dynamicTagsProps = {
124363
124453
  ...useTheme.props,
124364
124454
  ...commonProps,
@@ -124370,6 +124460,10 @@ img.ProseMirror-separator {
124370
124460
  type: Boolean,
124371
124461
  default: true
124372
124462
  },
124463
+ draggable: {
124464
+ type: Boolean,
124465
+ default: false
124466
+ },
124373
124467
  defaultValue: {
124374
124468
  type: Array,
124375
124469
  default: () => []
@@ -124382,13 +124476,48 @@ img.ProseMirror-separator {
124382
124476
  renderTag: Function,
124383
124477
  onCreate: {
124384
124478
  type: Function,
124385
- default: (label) => label
124479
+ default: label => label
124386
124480
  },
124387
124481
  "onUpdate:value": [Function, Array],
124388
124482
  onUpdateValue: [Function, Array],
124389
124483
  // deprecated
124390
124484
  onChange: [Function, Array]
124391
124485
  };
124486
+
124487
+ var style$M = cB("dynamic-tags", [cB("input", {
124488
+ minWidth: "var(--u-input-width)"
124489
+ }), cE("tag-wrapper", `
124490
+ display: flex;
124491
+ position: relative;
124492
+ cursor: default;
124493
+ `, [c$1("& > *", `
124494
+ cursor: inherit;
124495
+ `)]), cE("tag", [cM("draggable", `
124496
+ cursor: grab;
124497
+ user-select: none;
124498
+ `), cM("dragging", `
124499
+ opacity: var(--u-dragging-opacity);
124500
+ cursor: grabbing;
124501
+ `), cM("drop-before", [c$1("&::before", `
124502
+ content: '';
124503
+ position: absolute;
124504
+ top: 0;
124505
+ bottom: 0;
124506
+ left: -5px;
124507
+ width: 2px;
124508
+ border-radius: 2px;
124509
+ background-color: var(--u-drop-indicator-color);
124510
+ `)]), cM("drop-after", [c$1("&::after", `
124511
+ content: '';
124512
+ position: absolute;
124513
+ top: 0;
124514
+ bottom: 0;
124515
+ right: -5px;
124516
+ width: 2px;
124517
+ border-radius: 2px;
124518
+ background-color: var(--u-drop-indicator-color);
124519
+ `)])])]);
124520
+
124392
124521
  var _UDynamicTags = vue.defineComponent({
124393
124522
  name: "DynamicTags",
124394
124523
  props: dynamicTagsProps,
@@ -124404,14 +124533,9 @@ img.ProseMirror-separator {
124404
124533
  }
124405
124534
  });
124406
124535
  }
124407
- const { mergedClsPrefixRef, inlineThemeDisabled } = useConfig(props);
124408
124536
  const { localeRef } = useLocale("DynamicTags");
124537
+ const { mergedClsPrefixRef, inlineThemeDisabled } = useConfig(props);
124409
124538
  const formItem = useFormItem(props);
124410
- const { mergedDisabledRef } = formItem;
124411
- const inputValueRef = vue.ref("");
124412
- const showInputRef = vue.ref(false);
124413
- const inputForceFocusedRef = vue.ref(true);
124414
- const inputInstRef = vue.ref(null);
124415
124539
  const themeRef = useTheme(
124416
124540
  "DynamicTags",
124417
124541
  "-dynamic-tags",
@@ -124420,8 +124544,14 @@ img.ProseMirror-separator {
124420
124544
  props,
124421
124545
  mergedClsPrefixRef
124422
124546
  );
124547
+ const inputInstRef = vue.ref(null);
124548
+ const inputValueRef = vue.ref("");
124549
+ const showInputRef = vue.ref(false);
124550
+ const inputForceFocusedRef = vue.ref(true);
124423
124551
  const uncontrolledValueRef = vue.ref(props.defaultValue);
124424
124552
  const controlledValueRef = vue.toRef(props, "value");
124553
+ const dragIndexRef = vue.ref(null);
124554
+ const dragOverIndexRef = vue.ref(null);
124425
124555
  const mergedValueRef = useMergedState(
124426
124556
  controlledValueRef,
124427
124557
  uncontrolledValueRef
@@ -124432,38 +124562,44 @@ img.ProseMirror-separator {
124432
124562
  const inputSizeRef = vue.computed(() => {
124433
124563
  return smallerSize(props.size);
124434
124564
  });
124565
+ const buttonSizeRef = vue.computed(() => {
124566
+ return smallerSize(props.size);
124567
+ });
124435
124568
  const triggerDisabledRef = vue.computed(() => {
124436
- return mergedDisabledRef.value || !!props.max && mergedValueRef.value.length >= props.max;
124569
+ return formItem.mergedDisabledRef.value || !!props.max && mergedValueRef.value.length >= props.max;
124437
124570
  });
124438
- function doChange(value) {
124571
+ const cssVarsRef = vue.computed(() => {
124439
124572
  const {
124440
- onChange,
124441
- "onUpdate:value": _onUpdateValue,
124442
- onUpdateValue
124443
- } = props;
124444
- const { triggerFormInput, triggerFormChange } = formItem;
124445
- if (onChange)
124446
- call(onChange, value);
124447
- if (onUpdateValue)
124448
- call(onUpdateValue, value);
124449
- if (_onUpdateValue)
124450
- call(_onUpdateValue, value);
124573
+ self: { inputWidth, draggingOpacity, dropIndicatorColor }
124574
+ } = themeRef.value;
124575
+ return {
124576
+ "--u-input-width": inputWidth,
124577
+ "--u-dragging-opacity": draggingOpacity,
124578
+ "--u-drop-indicator-color": dropIndicatorColor
124579
+ };
124580
+ });
124581
+ const tagSizeRef = vue.computed(() => {
124582
+ const { size } = props;
124583
+ return size === "huge" ? "medium" : "small";
124584
+ });
124585
+ const themeClassHandle = inlineThemeDisabled ? useThemeClass("dynamic-tags", void 0, cssVarsRef, props) : void 0;
124586
+ const doChange = (value) => {
124587
+ if (props.onChange)
124588
+ call(props.onChange, value);
124589
+ if (props.onUpdateValue)
124590
+ call(props.onUpdateValue, value);
124591
+ if (props["onUpdate:value"])
124592
+ call(props["onUpdate:value"], value);
124451
124593
  uncontrolledValueRef.value = value;
124452
- triggerFormInput();
124453
- triggerFormChange();
124454
- }
124455
- function handleCloseClick(index) {
124594
+ formItem.triggerFormInput();
124595
+ formItem.triggerFormChange();
124596
+ };
124597
+ const handleCloseClick = (index) => {
124456
124598
  const tags = mergedValueRef.value.slice(0);
124457
124599
  tags.splice(index, 1);
124458
124600
  doChange(tags);
124459
- }
124460
- function handleInputKeyUp(e) {
124461
- switch (e.key) {
124462
- case "Enter":
124463
- handleInputConfirm();
124464
- }
124465
- }
124466
- function handleInputConfirm(externalValue) {
124601
+ };
124602
+ const handleInputConfirm = (externalValue) => {
124467
124603
  const nextValue = externalValue ?? inputValueRef.value;
124468
124604
  if (nextValue) {
124469
124605
  const tags = mergedValueRef.value.slice(0);
@@ -124473,60 +124609,125 @@ img.ProseMirror-separator {
124473
124609
  showInputRef.value = false;
124474
124610
  inputForceFocusedRef.value = true;
124475
124611
  inputValueRef.value = "";
124476
- }
124477
- function handleInputBlur() {
124612
+ };
124613
+ const handleInputKeyUp = (event) => {
124614
+ if (event.key === "Enter")
124615
+ handleInputConfirm();
124616
+ };
124617
+ const handleInputBlur = () => {
124478
124618
  handleInputConfirm();
124479
- }
124480
- function handleAddClick() {
124619
+ };
124620
+ const handleAddClick = () => {
124481
124621
  showInputRef.value = true;
124482
124622
  void vue.nextTick(() => {
124483
124623
  inputInstRef.value?.focus();
124484
124624
  inputForceFocusedRef.value = false;
124485
124625
  });
124486
- }
124487
- const cssVarsRef = vue.computed(() => {
124488
- const {
124489
- self: { inputWidth }
124490
- } = themeRef.value;
124626
+ };
124627
+ const moveItem = (from, to) => {
124628
+ if (from === to)
124629
+ return;
124630
+ const values = [...mergedValueRef.value];
124631
+ const [item] = values.splice(from, 1);
124632
+ values.splice(to, 0, item);
124633
+ doChange(values);
124634
+ };
124635
+ const resetDrag = () => {
124636
+ dragIndexRef.value = null;
124637
+ dragOverIndexRef.value = null;
124638
+ };
124639
+ const handleDragStart = (event, index) => {
124640
+ dragIndexRef.value = index;
124641
+ if (event.dataTransfer) {
124642
+ event.dataTransfer.effectAllowed = "move";
124643
+ event.dataTransfer.setData("text/plain", String(index));
124644
+ }
124645
+ };
124646
+ const handleDragOver = (event, index) => {
124647
+ if (dragIndexRef.value === null)
124648
+ return;
124649
+ event.preventDefault();
124650
+ dragOverIndexRef.value = index;
124651
+ };
124652
+ const handleDragLeave = (event, index) => {
124653
+ if (dragOverIndexRef.value !== index)
124654
+ return;
124655
+ const current = event.currentTarget;
124656
+ const related = event.relatedTarget;
124657
+ if (current && related && current.contains(related))
124658
+ return;
124659
+ dragOverIndexRef.value = null;
124660
+ };
124661
+ const handleDrop = (event, index) => {
124662
+ if (dragIndexRef.value === null)
124663
+ return;
124664
+ event.preventDefault();
124665
+ moveItem(dragIndexRef.value, index);
124666
+ resetDrag();
124667
+ };
124668
+ const getDragProps = (index) => {
124669
+ if (!props.draggable || formItem.mergedDisabledRef.value)
124670
+ return {};
124671
+ const prefix = `${mergedClsPrefixRef.value}-dynamic-tags__tag`;
124672
+ const from = dragIndexRef.value;
124673
+ const isOver = from !== null && dragOverIndexRef.value === index;
124491
124674
  return {
124492
- "--u-input-width": inputWidth
124675
+ class: [
124676
+ prefix,
124677
+ `${prefix}--draggable`,
124678
+ {
124679
+ [`${prefix}--dragging`]: from === index,
124680
+ [`${prefix}--drop-before`]: isOver && from > index,
124681
+ [`${prefix}--drop-after`]: isOver && from < index
124682
+ }
124683
+ ],
124684
+ draggable: true,
124685
+ onDragstart: (event) => handleDragStart(event, index),
124686
+ onDragover: (event) => handleDragOver(event, index),
124687
+ onDragleave: (event) => handleDragLeave(event, index),
124688
+ onDrop: (event) => handleDrop(event, index),
124689
+ onDragend: resetDrag
124493
124690
  };
124494
- });
124495
- const tagSizeRef = vue.computed(() => {
124496
- const { size } = props;
124497
- return size === "huge" ? "medium" : "small";
124498
- });
124499
- const themeClassHandle = inlineThemeDisabled ? useThemeClass("dynamic-tags", void 0, cssVarsRef, props) : void 0;
124691
+ };
124500
124692
  return {
124501
124693
  mergedClsPrefix: mergedClsPrefixRef,
124502
124694
  inputInstRef,
124503
124695
  localizedAdd: localizedAddRef,
124504
124696
  inputSize: inputSizeRef,
124505
124697
  inputValue: inputValueRef,
124698
+ buttonSize: buttonSizeRef,
124506
124699
  showInput: showInputRef,
124507
124700
  inputForceFocused: inputForceFocusedRef,
124508
124701
  mergedValue: mergedValueRef,
124509
- mergedDisabled: mergedDisabledRef,
124702
+ mergedDisabled: formItem.mergedDisabledRef,
124510
124703
  triggerDisabled: triggerDisabledRef,
124704
+ mergedTheme: themeRef,
124705
+ cssVars: inlineThemeDisabled ? void 0 : cssVarsRef,
124706
+ themeClass: themeClassHandle?.themeClass,
124707
+ tagSize: tagSizeRef,
124511
124708
  handleInputKeyUp,
124512
124709
  handleAddClick,
124513
124710
  handleInputBlur,
124514
124711
  handleCloseClick,
124515
124712
  handleInputConfirm,
124516
- mergedTheme: themeRef,
124517
- cssVars: inlineThemeDisabled ? void 0 : cssVarsRef,
124518
- themeClass: themeClassHandle?.themeClass,
124519
- onRender: themeClassHandle?.onRender,
124520
- tagSize: tagSizeRef
124713
+ getDragProps,
124714
+ onRender: themeClassHandle?.onRender
124521
124715
  };
124522
124716
  },
124523
124717
  render() {
124524
- const { mergedTheme, cssVars, mergedClsPrefix, onRender, renderTag } = this;
124718
+ const {
124719
+ mergedTheme,
124720
+ cssVars,
124721
+ mergedClsPrefix,
124722
+ themeClass,
124723
+ onRender,
124724
+ renderTag
124725
+ } = this;
124525
124726
  onRender?.();
124526
124727
  return /* @__PURE__ */ vue.h(
124527
124728
  USpace$1,
124528
124729
  {
124529
- class: [`${mergedClsPrefix}-dynamic-tags`, this.themeClass],
124730
+ class: [`${mergedClsPrefix}-dynamic-tags`, themeClass],
124530
124731
  size: "small",
124531
124732
  style: cssVars,
124532
124733
  theme: mergedTheme.peers.Space,
@@ -124537,36 +124738,64 @@ img.ProseMirror-separator {
124537
124738
  default: () => {
124538
124739
  const {
124539
124740
  mergedTheme: mergedTheme2,
124741
+ mergedValue,
124540
124742
  tagStyle,
124743
+ tagSize,
124541
124744
  type,
124542
124745
  round,
124543
124746
  color,
124544
124747
  closable,
124545
124748
  mergedDisabled,
124749
+ draggable,
124546
124750
  showInput,
124547
124751
  inputValue,
124548
124752
  inputStyle,
124753
+ inputProps,
124549
124754
  inputSize,
124755
+ buttonSize,
124550
124756
  inputForceFocused,
124551
124757
  triggerDisabled,
124758
+ $slots,
124552
124759
  handleInputKeyUp,
124553
124760
  handleInputBlur,
124554
124761
  handleAddClick,
124555
124762
  handleCloseClick,
124556
124763
  handleInputConfirm,
124557
- $slots
124764
+ getDragProps
124558
124765
  } = this;
124559
- return this.mergedValue.map(
124560
- (tag, index) => renderTag ? renderTag(tag, index) : /* @__PURE__ */ vue.h(
124766
+ return mergedValue.map((tag, index) => {
124767
+ if (renderTag) {
124768
+ const customTag = renderTag(
124769
+ tag,
124770
+ index
124771
+ );
124772
+ if (!draggable)
124773
+ return customTag;
124774
+ const dragProps = getDragProps(index);
124775
+ return /* @__PURE__ */ vue.h(
124776
+ "div",
124777
+ {
124778
+ key: index,
124779
+ ...dragProps,
124780
+ class: [
124781
+ `${mergedClsPrefix}-dynamic-tags__tag-wrapper`,
124782
+ dragProps.class
124783
+ ]
124784
+ },
124785
+ customTag
124786
+ );
124787
+ }
124788
+ return /* @__PURE__ */ vue.h(
124561
124789
  _UTag,
124562
124790
  {
124563
124791
  key: index,
124792
+ ...getDragProps(index),
124564
124793
  theme: mergedTheme2.peers.Tag,
124565
124794
  themeOverrides: mergedTheme2.peerOverrides.Tag,
124566
124795
  style: tagStyle,
124567
124796
  type,
124568
124797
  round,
124569
- size: this.tagSize,
124798
+ size: tagSize,
124570
124799
  color,
124571
124800
  closable,
124572
124801
  disabled: mergedDisabled,
@@ -124577,8 +124806,8 @@ img.ProseMirror-separator {
124577
124806
  {
124578
124807
  default: () => typeof tag === "string" ? tag : tag.label
124579
124808
  }
124580
- )
124581
- ).concat(
124809
+ );
124810
+ }).concat(
124582
124811
  showInput ? $slots.input ? $slots.input({
124583
124812
  submit: handleInputConfirm,
124584
124813
  deactivate: handleInputBlur
@@ -124589,7 +124818,7 @@ img.ProseMirror-separator {
124589
124818
  size: inputSize,
124590
124819
  style: inputStyle,
124591
124820
  autosize: true,
124592
- ...this.inputProps,
124821
+ ...inputProps,
124593
124822
  ref: "inputInstRef",
124594
124823
  value: inputValue,
124595
124824
  onUpdateValue: (v) => {
@@ -124611,7 +124840,7 @@ img.ProseMirror-separator {
124611
124840
  disabled: triggerDisabled,
124612
124841
  theme: mergedTheme2.peers.Button,
124613
124842
  themeOverrides: mergedTheme2.peerOverrides.Button,
124614
- size: inputSize,
124843
+ size: buttonSize,
124615
124844
  onClick: handleAddClick
124616
124845
  },
124617
124846
  {
@@ -155098,7 +155327,7 @@ ${icon.label}`.toLowerCase()
155098
155327
  });
155099
155328
  }
155100
155329
 
155101
- var version = "2.4.6";
155330
+ var version = "2.4.8";
155102
155331
 
155103
155332
  function create({
155104
155333
  componentPrefix = "U",