@bagelink/vue 1.5.15 → 1.5.20

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 (135) hide show
  1. package/bin/experimentalGenTypedRoutes.ts +15 -15
  2. package/bin/generateFormSchema.ts +12 -12
  3. package/bin/utils.ts +4 -4
  4. package/dist/components/Dropdown.vue.d.ts.map +1 -1
  5. package/dist/components/RouterWrapper.vue.d.ts.map +1 -1
  6. package/dist/components/calendar/CalendarPopover.vue.d.ts.map +1 -1
  7. package/dist/components/form/BagelForm.vue.d.ts.map +1 -1
  8. package/dist/components/form/FieldArray.vue.d.ts +5 -4
  9. package/dist/components/form/FieldArray.vue.d.ts.map +1 -1
  10. package/dist/components/form/inputs/CheckInput.vue.d.ts.map +1 -1
  11. package/dist/components/form/inputs/RichText/index.vue.d.ts +1 -0
  12. package/dist/components/form/inputs/RichText/index.vue.d.ts.map +1 -1
  13. package/dist/components/form/inputs/SelectInput.vue.d.ts.map +1 -1
  14. package/dist/components/form/inputs/ToggleInput.vue.d.ts.map +1 -1
  15. package/dist/components/form/inputs/Upload/UploadInput.vue.d.ts.map +1 -1
  16. package/dist/composables/useFormField.d.ts.map +1 -1
  17. package/dist/composables/useSchemaField.d.ts.map +1 -1
  18. package/dist/index.cjs +68 -55
  19. package/dist/index.mjs +34035 -143
  20. package/dist/style.css +1 -1
  21. package/package.json +1 -1
  22. package/src/components/AccordionItem.vue +2 -2
  23. package/src/components/AddToCalendar.vue +1 -1
  24. package/src/components/BglVideo.vue +8 -8
  25. package/src/components/Btn.vue +9 -9
  26. package/src/components/Card.vue +4 -4
  27. package/src/components/Carousel.vue +44 -44
  28. package/src/components/DataPreview.vue +1 -1
  29. package/src/components/DragOver.vue +6 -6
  30. package/src/components/Dropdown.vue +14 -14
  31. package/src/components/Flag.vue +3 -3
  32. package/src/components/Icon/Icon.vue +13 -13
  33. package/src/components/Image.vue +4 -4
  34. package/src/components/ImportData.vue +79 -79
  35. package/src/components/ListItem.vue +7 -7
  36. package/src/components/MapEmbed/Index.vue +6 -6
  37. package/src/components/Modal.vue +10 -10
  38. package/src/components/ModalForm.vue +4 -4
  39. package/src/components/NavBar.vue +2 -2
  40. package/src/components/Pagination.vue +9 -9
  41. package/src/components/Pill.vue +1 -1
  42. package/src/components/Rating.vue +2 -2
  43. package/src/components/RouterWrapper.vue +3 -3
  44. package/src/components/Slider.vue +77 -77
  45. package/src/components/Spreadsheet/Index.vue +34 -34
  46. package/src/components/Spreadsheet/SpreadsheetTable.vue +3 -3
  47. package/src/components/Zoomer.vue +28 -28
  48. package/src/components/analytics/BarChart.vue +6 -6
  49. package/src/components/analytics/KpiCard.vue +2 -2
  50. package/src/components/analytics/LineChart.vue +14 -14
  51. package/src/components/analytics/PieChart.vue +11 -11
  52. package/src/components/calendar/CalendarPopover.vue +1 -1
  53. package/src/components/calendar/Index.vue +1 -1
  54. package/src/components/calendar/views/AgendaView.vue +2 -2
  55. package/src/components/calendar/views/DayView.vue +6 -6
  56. package/src/components/calendar/views/MonthView.vue +2 -2
  57. package/src/components/calendar/views/WeekView.vue +18 -18
  58. package/src/components/dataTable/DataTable.vue +3 -3
  59. package/src/components/dataTable/useSorting.ts +1 -1
  60. package/src/components/dataTable/useTableData.ts +15 -15
  61. package/src/components/dataTable/useTableSelection.ts +8 -8
  62. package/src/components/dataTable/useTableVirtualization.ts +1 -1
  63. package/src/components/draggable/useDraggable.ts +42 -42
  64. package/src/components/form/BagelForm.vue +66 -23
  65. package/src/components/form/BglMultiStepForm.vue +18 -18
  66. package/src/components/form/FieldArray.vue +177 -67
  67. package/src/components/form/inputs/CheckInput.vue +2 -1
  68. package/src/components/form/inputs/CodeEditor/Index.vue +1 -1
  69. package/src/components/form/inputs/CodeEditor/format.ts +7 -7
  70. package/src/components/form/inputs/CodeEditor/useHighlight.ts +6 -6
  71. package/src/components/form/inputs/DateInput.vue +6 -6
  72. package/src/components/form/inputs/DatePicker.vue +19 -19
  73. package/src/components/form/inputs/EmailInput.vue +14 -14
  74. package/src/components/form/inputs/NumberInput.vue +6 -6
  75. package/src/components/form/inputs/OTP.vue +3 -3
  76. package/src/components/form/inputs/RadioGroup.vue +1 -1
  77. package/src/components/form/inputs/RadioPillsInput.vue +8 -8
  78. package/src/components/form/inputs/RichText/components/EditorToolbar.vue +10 -10
  79. package/src/components/form/inputs/RichText/components/TableGridSelector.vue +1 -1
  80. package/src/components/form/inputs/RichText/composables/useCommands.ts +1 -1
  81. package/src/components/form/inputs/RichText/composables/useEditor.ts +12 -12
  82. package/src/components/form/inputs/RichText/composables/useEditorKeyboard.ts +1 -1
  83. package/src/components/form/inputs/RichText/index.vue +300 -132
  84. package/src/components/form/inputs/RichText/utils/commands.ts +69 -69
  85. package/src/components/form/inputs/RichText/utils/debug.ts +1 -1
  86. package/src/components/form/inputs/RichText/utils/formatting.ts +39 -39
  87. package/src/components/form/inputs/RichText/utils/media.ts +6 -6
  88. package/src/components/form/inputs/RichText/utils/selection.ts +28 -28
  89. package/src/components/form/inputs/RichText/utils/table.ts +19 -19
  90. package/src/components/form/inputs/SelectBtn.vue +1 -1
  91. package/src/components/form/inputs/SelectInput.vue +50 -26
  92. package/src/components/form/inputs/SignaturePad.vue +15 -15
  93. package/src/components/form/inputs/TableField.vue +1 -1
  94. package/src/components/form/inputs/TelInput.vue +6 -6
  95. package/src/components/form/inputs/TextInput.vue +5 -5
  96. package/src/components/form/inputs/ToggleInput.vue +2 -1
  97. package/src/components/form/inputs/Upload/UploadInput.vue +155 -102
  98. package/src/components/form/inputs/Upload/upload.ts +1 -1
  99. package/src/components/form/inputs/Upload/useFileUpload.ts +6 -6
  100. package/src/components/form/useBagelFormState.ts +5 -5
  101. package/src/components/layout/AppContent.vue +1 -1
  102. package/src/components/layout/AppLayout.vue +1 -1
  103. package/src/components/layout/Layout.vue +4 -4
  104. package/src/components/layout/TabbedLayout.vue +1 -1
  105. package/src/components/layout/Tabs.vue +2 -2
  106. package/src/components/layout/TabsNav.vue +7 -7
  107. package/src/components/lightbox/Lightbox.vue +8 -8
  108. package/src/components/lightbox/index.ts +8 -8
  109. package/src/composables/index.ts +2 -2
  110. package/src/composables/useAddToCalendar.ts +13 -13
  111. package/src/composables/useDevice.ts +2 -2
  112. package/src/composables/useExcel.ts +6 -6
  113. package/src/composables/useFormField.ts +5 -9
  114. package/src/composables/usePolling.ts +8 -8
  115. package/src/composables/useSchemaField.ts +53 -38
  116. package/src/composables/useTheme.ts +9 -9
  117. package/src/composables/useValidateFieldValue.ts +2 -2
  118. package/src/directives/pattern.ts +25 -25
  119. package/src/directives/ripple.ts +4 -4
  120. package/src/directives/vResize.ts +6 -6
  121. package/src/plugins/bagel.ts +4 -4
  122. package/src/plugins/useModal.ts +3 -3
  123. package/src/styles/layout.css +7 -1
  124. package/src/utils/BagelFormUtils.ts +7 -7
  125. package/src/utils/calendar/Helpers.ts +8 -8
  126. package/src/utils/calendar/dateUtils.ts +22 -22
  127. package/src/utils/calendar/time.ts +25 -25
  128. package/src/utils/calendar/week.ts +25 -25
  129. package/src/utils/elementUtils.ts +27 -27
  130. package/src/utils/index.ts +22 -22
  131. package/src/utils/sizeParsing.ts +2 -2
  132. package/src/utils/strings.ts +5 -5
  133. package/src/utils/tapDetector.ts +11 -11
  134. package/src/utils/useSearch.ts +29 -29
  135. package/vite.config.ts +1 -1
@@ -13,7 +13,7 @@ const props = withDefaults(defineProps<PropTypes>(), {
13
13
 
14
14
  const emit = defineEmits(['update:modelValue'])
15
15
 
16
- const isAsyncSource = (src: OptionsSource): src is (q: string) => Promise<Option[]> => typeof src === 'function'
16
+ const isAsyncSource = (src: OptionsSource): src is (q: string) => Promise<Option[]> => 'function' === typeof src
17
17
 
18
18
  type Primitive = string | number | boolean
19
19
 
@@ -48,8 +48,8 @@ let selected = $ref(false)
48
48
  let open = $ref(false)
49
49
 
50
50
  const selectedLabel = $computed((): string => {
51
- if (selectedItemCount === 0) return props.placeholder
52
- if (selectedItemCount > 4) {
51
+ if (0 === selectedItemCount) {return props.placeholder}
52
+ if (4 < selectedItemCount) {
53
53
  const str = selectedItems
54
54
  .slice(0, 4)
55
55
  .map(item => getLabel(item))
@@ -77,30 +77,30 @@ function navigate(direction: 'up' | 'down') {
77
77
  setTimeout(() => { navigate(direction) }, 210)
78
78
  return
79
79
  }
80
- if (direction === 'up') {
81
- highlightedIndex = highlightedIndex > 0 ? highlightedIndex - 1 : results.value.length - 1
82
- } else if (direction === 'down') {
80
+ if ('up' === direction) {
81
+ highlightedIndex = 0 < highlightedIndex ? highlightedIndex - 1 : results.value.length - 1
82
+ } else if ('down' === direction) {
83
83
  highlightedIndex = highlightedIndex < results.value.length - 1 ? highlightedIndex + 1 : 0
84
84
  }
85
85
  setTimeout(() => {
86
86
  const el = selectOptions?.children[highlightedIndex] as HTMLElement
87
- if (el) el.focus()
88
- else highlightedIndex = -1
87
+ if (el) {el.focus()}
88
+ else {highlightedIndex = -1}
89
89
  }, 10)
90
90
  }
91
91
 
92
92
  const isSelected = (option: Option) => selectedItems.find(item => getValue(option) === getValue(item)) !== undefined
93
93
 
94
94
  function scrollToSelectedItem() {
95
- if (!selectOptions || selectedItemCount === 0) return
95
+ if (!selectOptions || 0 === selectedItemCount) {return}
96
96
 
97
97
  // Find the first selected item in the results
98
98
  const selectedIndex = results.value.findIndex(option => isSelected(option))
99
- if (selectedIndex === -1) return
99
+ if (-1 === selectedIndex) {return}
100
100
 
101
101
  // Get the selected option element
102
102
  const selectedElement = selectOptions.children[selectedIndex] as HTMLElement
103
- if (!selectedElement) return
103
+ if (!selectedElement) {return}
104
104
 
105
105
  // Scroll the selected item into view
106
106
  selectedElement.scrollIntoView({
@@ -110,22 +110,22 @@ function scrollToSelectedItem() {
110
110
  }
111
111
 
112
112
  function getLabel(option: Option) {
113
- if (option == null) return ''
114
- if (typeof option === 'object') return option.label ?? String((option as any).value ?? '')
115
- if (typeof option === 'boolean') return option ? 'Yes' : 'No'
113
+ if (null == option) {return ''}
114
+ if ('object' === typeof option) {return option.label ?? String((option as any).value ?? '')}
115
+ if ('boolean' === typeof option) {return option ? 'Yes' : 'No'}
116
116
  return String(option)
117
117
  }
118
118
 
119
119
  function getValue(option?: Option): Primitive | undefined {
120
- if (option == null) return
121
- if (typeof option === 'object') return option.value as Primitive
120
+ if (null == option) {return}
121
+ if ('object' === typeof option) {return option.value as Primitive}
122
122
  return option as Primitive
123
123
  }
124
124
 
125
125
  function focusInput() {
126
126
  open = true
127
127
  setTimeout(() => {
128
- if (searchInput) searchInput.focus()
128
+ if (searchInput) {searchInput.focus()}
129
129
  }, 10)
130
130
  }
131
131
 
@@ -134,7 +134,7 @@ function select(option: Option) {
134
134
  const existingIndex = selectedItems.findIndex(
135
135
  item => getValue(item) === getValue(option),
136
136
  )
137
- if (existingIndex > -1) {
137
+ if (-1 < existingIndex) {
138
138
  selectedItems.splice(existingIndex, 1)
139
139
  }
140
140
  else if (props.multiselect) {
@@ -148,7 +148,7 @@ function select(option: Option) {
148
148
 
149
149
  // Move focus away from popper content before it gets aria-hidden
150
150
  const active = document.activeElement as HTMLElement | null
151
- if (active && selectOptions?.contains(active)) active.blur()
151
+ if (active && selectOptions?.contains(active)) {active.blur()}
152
152
 
153
153
  if (!props.multiselect) {
154
154
  open = false
@@ -169,7 +169,7 @@ function emitUpdate() {
169
169
  }
170
170
 
171
171
  function compareArrays(arr1: Option[], arr2: Option[]) {
172
- if (arr1.length !== arr2.length) return false
172
+ if (arr1.length !== arr2.length) {return false}
173
173
  const s1 = arr1.map(getValue).filter(Boolean).map(String).sort()
174
174
  const s2 = arr2.map(getValue).filter(Boolean).map(String).sort()
175
175
  return s1.every((v, i) => v === s2[i])
@@ -182,7 +182,7 @@ watch(
182
182
  const newOption = Array.isArray(props.options)
183
183
  ? (props.options.find(o => getValue(o) === newVal) ?? newVal)
184
184
  : newVal
185
- if (newOption && !isSelected(newOption)) selectedItems = [newOption]
185
+ if (newOption && !isSelected(newOption)) {selectedItems = [newOption]}
186
186
  } else {
187
187
  const newData = [newVal].flat()
188
188
  const isSame = compareArrays(newData, selectedItems)
@@ -206,13 +206,13 @@ watch(
206
206
  () => props.options,
207
207
  () => {
208
208
  const opts = props.options
209
- if (!Array.isArray(opts)) return
209
+ if (!Array.isArray(opts)) {return}
210
210
  selectedItems.forEach((option, i) => {
211
211
  const exists = opts.find(
212
212
  (o: Option) => getValue(o) === getValue(option),
213
213
  )
214
- if (exists === undefined) selectedItems.splice(i, 1)
215
- else selectedItems.splice(i, 1, exists)
214
+ if (exists === undefined) {selectedItems.splice(i, 1)}
215
+ else {selectedItems.splice(i, 1, exists)}
216
216
  })
217
217
  // const original = JSON.stringify(props.options.map(getValue));
218
218
  // const newSelection = JSON.stringify(selectedItems.map(getValue));
@@ -221,6 +221,28 @@ watch(
221
221
  { deep: true, immediate: true },
222
222
  )
223
223
 
224
+ // Watch for async results to update selected items with full option objects
225
+ watch(
226
+ () => results.value,
227
+ (newResults) => {
228
+ if (isAsyncSource(props.options) && 0 < newResults.length) {
229
+ selectedItems.forEach((option, i) => {
230
+ const optionValue = getValue(option)
231
+ // If the selected item is just a primitive value (no label), find the full option
232
+ if ('object' !== typeof option || !option.label) {
233
+ const fullOption = newResults.find(
234
+ (o: Option) => getValue(o) === optionValue,
235
+ )
236
+ if (fullOption) {
237
+ selectedItems.splice(i, 1, fullOption)
238
+ }
239
+ }
240
+ })
241
+ }
242
+ },
243
+ { deep: true },
244
+ )
245
+
224
246
  onMounted(() => {
225
247
  const opts = props.options
226
248
  if (props.defaultValue !== undefined && Array.isArray(opts)) {
@@ -228,7 +250,7 @@ onMounted(() => {
228
250
  (o: Option) => getValue(o) === getValue(props.defaultValue),
229
251
  )
230
252
 
231
- if (defaultOption === undefined) return
253
+ if (defaultOption === undefined) {return}
232
254
 
233
255
  selectedItems = [defaultOption]
234
256
  }
@@ -290,7 +312,9 @@ onMounted(() => {
290
312
  {{ getLabel(option) }}
291
313
  </span>
292
314
  </div>
293
- <p v-if="results.length === 0" class="selectinput-option opacity-3 pointer-events-none">No options found</p>
315
+ <p v-if="results.length === 0" class="selectinput-option opacity-3 pointer-events-none">
316
+ No options found
317
+ </p>
294
318
  </div>
295
319
  <slot name="last" />
296
320
  </Card>
@@ -57,16 +57,16 @@ function save(format?: FormatType) {
57
57
 
58
58
  function saveFile() {
59
59
  const data = save()
60
- if (!data) return
60
+ if (!data) {return}
61
61
 
62
- if (props.format === 'image/svg+xml') {
62
+ if ('image/svg+xml' === props.format) {
63
63
  // For SVG, create file directly from the SVG string
64
64
  fileData.value = new File([data], 'signature.svg', { type: 'image/svg+xml' })
65
65
  } else {
66
66
  try {
67
67
  // For PNG/JPG, convert base64 to blob first
68
68
  const base64Data = data.split(',')[1]
69
- if (!base64Data) throw new Error('Invalid data URL format')
69
+ if (!base64Data) {throw new Error('Invalid data URL format')}
70
70
 
71
71
  const byteCharacters = atob(base64Data)
72
72
  // Create byte array directly with mapping function
@@ -114,13 +114,13 @@ const signatureOptions = $computed(() => ({ ...defaultOptions, ...props.sigOptio
114
114
  watch(
115
115
  () => props.disabled,
116
116
  (val) => {
117
- if (val) sig?.off()
118
- else sig?.on()
117
+ if (val) {sig?.off()}
118
+ else {sig?.on()}
119
119
  },
120
120
  )
121
121
 
122
122
  function addWaterMark(data: WaterMark) {
123
- if (!(Object.prototype.toString.call(data) === '[object Object]')) {
123
+ if (!('[object Object]' === Object.prototype.toString.call(data))) {
124
124
  throw new Error(`Expected Object, got ${typeof data}.`)
125
125
  } else {
126
126
  const textData = {
@@ -132,14 +132,14 @@ function addWaterMark(data: WaterMark) {
132
132
  }
133
133
 
134
134
  const ctx = vCanvas?.getContext('2d')
135
- if (!ctx) return
135
+ if (!ctx) {return}
136
136
  ctx.font = data.font || '20px sans-serif'
137
137
  ctx.fillStyle = data.fillStyle || '#333'
138
138
  ctx.strokeStyle = data.strokeStyle || '#333'
139
- if (data.style === 'all') {
139
+ if ('all' === data.style) {
140
140
  ctx.fillText(textData.text, textData.x, textData.y)
141
141
  ctx.strokeText(textData.text, textData.sx, textData.sy)
142
- } else if (data.style === 'stroke') {
142
+ } else if ('stroke' === data.style) {
143
143
  ctx.strokeText(textData.text, textData.sx, textData.sy)
144
144
  } else {
145
145
  ctx.fillText(textData.text, textData.x, textData.y)
@@ -155,7 +155,7 @@ function onEndStroke() {
155
155
  }
156
156
 
157
157
  function loadFile(file: File | undefined) {
158
- if (!file) return
158
+ if (!file) {return}
159
159
  const reader = new FileReader()
160
160
  return new Promise((resolve) => {
161
161
  reader.onload = (e) => {
@@ -175,21 +175,21 @@ watch(fileData, (newFile) => {
175
175
 
176
176
  function resizeCanvas() {
177
177
  let url
178
- if (!isEmpty()) url = save()
178
+ if (!isEmpty()) {url = save()}
179
179
  const ratio = props.ratio ?? 1 / 2
180
180
  const { width } = vCanvas!.getBoundingClientRect()
181
181
  vCanvas!.width = props.width ? Number(props.width.replaceAll('px', '')) : width
182
182
  vCanvas!.height = props.height ? Number(props.height.replaceAll('px', '')) : width * ratio
183
183
  clear()
184
- if (!props.clearOnResize && url !== undefined) void fromDataURL(url)
185
- if (props.waterMark) addWaterMark(props.waterMark)
184
+ if (!props.clearOnResize && url !== undefined) {void fromDataURL(url)}
185
+ if (props.waterMark) {addWaterMark(props.waterMark)}
186
186
  }
187
187
 
188
188
  function draw() {
189
189
  sig = new SignaturePad(vCanvas!, signatureOptions)
190
190
  resizeCanvas()
191
- if (props.disabled) sig.off()
192
- else sig.on()
191
+ if (props.disabled) {sig.off()}
192
+ else {sig.on()}
193
193
  _isEmpty = sig.isEmpty()
194
194
 
195
195
  // Load initial file if provided
@@ -40,7 +40,7 @@ function addRow() {
40
40
  } as { [key: string]: any }
41
41
  entityMeta?.fields.forEach((field: any) => {
42
42
  if (field.default) {
43
- if (field.fieldtype === 'Check') {
43
+ if ('Check' === field.fieldtype) {
44
44
  entry[field.fieldname] = Number.parseInt(field.default)
45
45
  } else {
46
46
  entry[field.fieldname] = field.default
@@ -93,7 +93,7 @@ function getCountryCode(): CountryCode | undefined {
93
93
 
94
94
  // Parse and format the phone number
95
95
  function parseAndFormatPhoneNumber(value: string): string {
96
- if (!value) return value
96
+ if (!value) {return value}
97
97
 
98
98
  try {
99
99
  const parsedNumber = parsePhoneNumberFromString(value, getCountryCode())
@@ -108,7 +108,7 @@ function parseAndFormatPhoneNumber(value: string): string {
108
108
 
109
109
  // Validate the phone number and set custom validity
110
110
  function validatePhoneNumber() {
111
- if (!inputRef.value) return
111
+ if (!inputRef.value) {return}
112
112
 
113
113
  try {
114
114
  const parsedNumber = parsePhoneNumberFromString(phoneNumber, getCountryCode())
@@ -126,10 +126,10 @@ function validatePhoneNumber() {
126
126
  }
127
127
 
128
128
  function detectCountryFromNumber(value: string): boolean {
129
- if (!value.startsWith('+')) return false
129
+ if (!value.startsWith('+')) {return false}
130
130
 
131
131
  const digits = value.replace(/\D/g, '')
132
- if (digits.length <= 1) return false
132
+ if (1 >= digits.length) {return false}
133
133
 
134
134
  for (const country of countries) {
135
135
  if (digits.startsWith(country.dialCode) && country !== activeCountry) {
@@ -187,8 +187,8 @@ function handleBlur(event: Event) {
187
187
  emit('blur', event)
188
188
  }
189
189
 
190
- const disableDropdown = $computed(() => countries.length === 1 && !search)
191
- const searchable = $computed(() => countries.length > 7 || search)
190
+ const disableDropdown = $computed(() => 1 === countries.length && !search)
191
+ const searchable = $computed(() => 7 < countries.length || search)
192
192
 
193
193
  function focusSearchInput() {
194
194
  setTimeout(() => searchInput?.focus(), 100)
@@ -58,8 +58,8 @@ useValidateFieldValue(
58
58
  const inputRows = $computed(() => {
59
59
  let rows = Number(props.rows) || 1
60
60
  if (props.autoheight)
61
- rows = Math.max(rows, String(inputVal).split('\n').length)
62
- if (props.multiline || props.code) rows = Math.max(rows, 4)
61
+ {rows = Math.max(rows, String(inputVal).split('\n').length)}
62
+ if (props.multiline || props.code) {rows = Math.max(rows, 4)}
63
63
  return rows
64
64
  })
65
65
 
@@ -68,7 +68,7 @@ const debouncedEmit = useDebounceFn(() => {
68
68
  }, 700)
69
69
 
70
70
  function autoResizeTextarea() {
71
- if (!props.autoheight || !input || input.tagName !== 'TEXTAREA') return
71
+ if (!props.autoheight || !input || 'TEXTAREA' !== input.tagName) {return}
72
72
 
73
73
  const textarea = input as HTMLTextAreaElement
74
74
  textarea.style.height = 'auto'
@@ -76,7 +76,7 @@ function autoResizeTextarea() {
76
76
  }
77
77
 
78
78
  function updateInputVal() {
79
- if (props.disabled) return
79
+ if (props.disabled) {return}
80
80
  emit('update:modelValue', inputVal as string)
81
81
  debouncedEmit()
82
82
 
@@ -108,7 +108,7 @@ onMounted(async () => {
108
108
  await sleep(400)
109
109
  input?.focus()
110
110
  }
111
- if (props.defaultValue && !props.modelValue) inputVal = props.defaultValue
111
+ // Don't auto-restore defaultValue - let user control their own content
112
112
 
113
113
  if (props.autoheight) {
114
114
  await nextTick()
@@ -15,7 +15,8 @@ const inputId = $ref(props.id || Math.random().toString(36).slice(7))
15
15
  const checked = defineModel<boolean | undefined>('modelValue', { default: undefined })
16
16
 
17
17
  onMounted(() => {
18
- if (checked.value === undefined) checked.value = props.defaultValue
18
+ // Don't auto-restore defaultValue - let user control their own content
19
+ // if (checked.value === undefined) checked.value = props.defaultValue
19
20
  })
20
21
  </script>
21
22