@nmorph/nmorph-ui-kit 2.2.37 → 2.2.39

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 (239) hide show
  1. package/dist/components/basic/nmorph-button/NmorphButton.vue2.js +4 -4
  2. package/dist/components/basic/nmorph-layout/NmorphLayout.vue2.js +12 -10
  3. package/dist/components/basic/nmorph-link/NmorphLink.vue2.js +19 -16
  4. package/dist/components/data/nmorph-badge/NmorphBadge.css +1 -1
  5. package/dist/components/data/nmorph-badge/NmorphBadge.vue2.js +30 -26
  6. package/dist/components/data/nmorph-calendar/NmorphCalendar.vue2.js +42 -40
  7. package/dist/components/data/nmorph-card/NmorphCard.vue2.js +16 -13
  8. package/dist/components/data/nmorph-collapse/components/nmorph-collapse-item/NmorphCollapseItem.vue2.js +24 -21
  9. package/dist/components/data/nmorph-empty/NmorphEmpty.vue2.js +23 -21
  10. package/dist/components/data/nmorph-image-preview/NmorphImagePreview.vue.js +43 -42
  11. package/dist/components/data/nmorph-image-preview/NmorphImagePreview.vue2.js +47 -45
  12. package/dist/components/data/nmorph-progress/NmorphProgress.vue2.js +18 -14
  13. package/dist/components/data/nmorph-qr-code/NmorphQRCode.vue2.js +15 -11
  14. package/dist/components/data/nmorph-skeleton/NmorphSkeleton.vue2.js +15 -12
  15. package/dist/components/data/nmorph-table/NmorphTable.vue2.js +44 -40
  16. package/dist/components/data/nmorph-tag-list/components/nmorph-tag-item/NmorphTagItem.vue2.js +1 -1
  17. package/dist/components/data/nmorph-virtual-list/NmorphVirtualList.vue2.js +21 -19
  18. package/dist/components/feedback/nmorph-alert/NmorphAlert.vue2.js +27 -24
  19. package/dist/components/feedback/nmorph-callout/NmorphCallout.vue2.js +19 -15
  20. package/dist/components/feedback/nmorph-drawer/NmorphDrawer.vue2.js +10 -8
  21. package/dist/components/feedback/nmorph-tooltip/NmorphTooltip.vue2.js +25 -23
  22. package/dist/components/form/nmorph-autocomplete/NmorphAutocomplete.vue2.js +66 -64
  23. package/dist/components/form/nmorph-checkbox/NmorphCheckbox.css +1 -1
  24. package/dist/components/form/nmorph-checkbox/NmorphCheckbox.vue2.js +28 -26
  25. package/dist/components/form/nmorph-checkbox-group/NmorphCheckboxGroup.vue2.js +25 -20
  26. package/dist/components/form/nmorph-color-picker/NmorphColorPicker.vue.js +18 -22
  27. package/dist/components/form/nmorph-color-picker/NmorphColorPicker.vue2.js +52 -42
  28. package/dist/components/form/nmorph-date-picker/NmorphDatePicker.vue2.js +52 -40
  29. package/dist/components/form/nmorph-file-upload/NmorphFileUpload.css +1 -1
  30. package/dist/components/form/nmorph-file-upload/NmorphFileUpload.vue.js +20 -16
  31. package/dist/components/form/nmorph-file-upload/NmorphFileUpload.vue2.js +96 -98
  32. package/dist/components/form/nmorph-form/NmorphForm.vue2.js +9 -9
  33. package/dist/components/form/nmorph-form/components/nmorph-form-item/NmorphFormItem.css +1 -1
  34. package/dist/components/form/nmorph-form/components/nmorph-form-item/NmorphFormItem.vue2.js +33 -24
  35. package/dist/components/form/nmorph-form/components/nmorph-form-item/inner-components/nmorph-error-box/NmorphErrorBox.vue2.js +4 -4
  36. package/dist/components/form/nmorph-form/use-form-item-input.js +29 -8
  37. package/dist/components/form/nmorph-number-input/NmorphNumberInput.vue2.js +41 -35
  38. package/dist/components/form/nmorph-otp-input/NmorphOTPInput.vue2.js +65 -61
  39. package/dist/components/form/nmorph-radio/NmorphRadio.css +1 -1
  40. package/dist/components/form/nmorph-radio/NmorphRadio.vue2.js +1 -1
  41. package/dist/components/form/nmorph-radio-group/NmorphRadioGroup.vue2.js +24 -22
  42. package/dist/components/form/nmorph-select/NmorphSelect.css +1 -1
  43. package/dist/components/form/nmorph-select/NmorphSelect.vue2.js +90 -78
  44. package/dist/components/form/nmorph-select/components/nmorph-select-option/NmorphSelectOption.vue2.js +21 -18
  45. package/dist/components/form/nmorph-select-button/NmorphSelectButton.vue2.js +31 -25
  46. package/dist/components/form/nmorph-slider/NmorphSlider.vue2.js +50 -49
  47. package/dist/components/form/nmorph-switch/NmorphSwitch.vue2.js +35 -32
  48. package/dist/components/form/nmorph-text-input/NmorphTextInput.css +1 -1
  49. package/dist/components/form/nmorph-text-input/NmorphTextInput.vue.js +17 -17
  50. package/dist/components/form/nmorph-text-input/NmorphTextInput.vue2.js +41 -35
  51. package/dist/components/form/nmorph-textarea/NmorphTextarea.vue.js +13 -13
  52. package/dist/components/form/nmorph-textarea/NmorphTextarea.vue2.js +38 -32
  53. package/dist/components/form/nmorph-time-picker/NmorphTimePicker.vue.js +17 -17
  54. package/dist/components/form/nmorph-time-picker/NmorphTimePicker.vue2.js +79 -71
  55. package/dist/components/navigation/nmorph-dropdown/NmorphDropdown.vue2.js +25 -23
  56. package/dist/hooks/use-field-validation.js +56 -43
  57. package/dist/hooks/use-focusable-input.js +27 -0
  58. package/dist/hooks/use-form-validation.js +62 -24
  59. package/dist/hooks/use-nmorph-translation.js +4 -4
  60. package/dist/index.es.js +842 -837
  61. package/dist/index.umd.js +36 -36
  62. package/dist/package.json.js +1 -1
  63. package/dist/plugin.js +47 -42
  64. package/dist/src/components/basic/nmorph-button/NmorphButton.vue.d.ts +4 -17
  65. package/dist/src/components/basic/nmorph-button/types.d.ts +13 -0
  66. package/dist/src/components/basic/nmorph-icon/NmorphIcon.vue.d.ts +3 -9
  67. package/dist/src/components/basic/nmorph-icon/types.d.ts +6 -0
  68. package/dist/src/components/basic/nmorph-layout/NmorphLayout.vue.d.ts +2 -9
  69. package/dist/src/components/basic/nmorph-layout/types.d.ts +8 -0
  70. package/dist/src/components/basic/nmorph-link/NmorphLink.vue.d.ts +2 -13
  71. package/dist/src/components/basic/nmorph-link/types.d.ts +11 -0
  72. package/dist/src/components/basic/nmorph-scroll/NmorphScroll.vue.d.ts +2 -2
  73. package/dist/src/components/basic/nmorph-scroll/types.d.ts +5 -0
  74. package/dist/src/components/basic/nmorph-space/NmorphSpace.vue.d.ts +2 -15
  75. package/dist/src/components/basic/nmorph-space/types.d.ts +14 -0
  76. package/dist/src/components/data/nmorph-avatar/NmorphAvatar.vue.d.ts +6 -21
  77. package/dist/src/components/data/nmorph-avatar/types.d.ts +21 -0
  78. package/dist/src/components/data/nmorph-badge/NmorphBadge.vue.d.ts +4 -39
  79. package/dist/src/components/data/nmorph-badge/types.d.ts +34 -0
  80. package/dist/src/components/data/nmorph-calendar/NmorphCalendar.vue.d.ts +4 -12
  81. package/dist/src/components/data/nmorph-calendar/inner-components/nmorph-calendar-header/NmorphCalendarHeader.vue.d.ts +3 -9
  82. package/dist/src/components/data/nmorph-calendar/inner-components/nmorph-calendar-header/types.d.ts +12 -0
  83. package/dist/src/components/data/nmorph-calendar/types.d.ts +13 -0
  84. package/dist/src/components/data/nmorph-card/NmorphCard.vue.d.ts +2 -10
  85. package/dist/src/components/data/nmorph-card/types.d.ts +9 -0
  86. package/dist/src/components/data/nmorph-carousel/NmorphCarousel.vue.d.ts +3 -5
  87. package/dist/src/components/data/nmorph-carousel/components/nmorph-carousel-item/NmorphCarouselItem.vue.d.ts +2 -4
  88. package/dist/src/components/data/nmorph-carousel/components/nmorph-carousel-item/types.d.ts +3 -0
  89. package/dist/src/components/data/nmorph-carousel/types.d.ts +6 -0
  90. package/dist/src/components/data/nmorph-collapse/NmorphCollapse.vue.d.ts +3 -7
  91. package/dist/src/components/data/nmorph-collapse/components/nmorph-collapse-item/NmorphCollapseItem.vue.d.ts +4 -10
  92. package/dist/src/components/data/nmorph-collapse/components/nmorph-collapse-item/types.d.ts +13 -0
  93. package/dist/src/components/data/nmorph-collapse/types.d.ts +7 -0
  94. package/dist/src/components/data/nmorph-empty/NmorphEmpty.vue.d.ts +4 -13
  95. package/dist/src/components/data/nmorph-empty/types.d.ts +11 -0
  96. package/dist/src/components/data/nmorph-image/NmorphImage.vue.d.ts +3 -8
  97. package/dist/src/components/data/nmorph-image/types.d.ts +10 -0
  98. package/dist/src/components/data/nmorph-image-preview/NmorphImagePreview.vue.d.ts +3 -18
  99. package/dist/src/components/data/nmorph-image-preview/types.d.ts +19 -0
  100. package/dist/src/components/data/nmorph-pagination/NmorphPagination.vue.d.ts +3 -13
  101. package/dist/src/components/data/nmorph-pagination/types.d.ts +14 -0
  102. package/dist/src/components/data/nmorph-progress/NmorphProgress.vue.d.ts +2 -14
  103. package/dist/src/components/data/nmorph-progress/types.d.ts +12 -0
  104. package/dist/src/components/data/nmorph-qr-code/NmorphQRCode.vue.d.ts +5 -15
  105. package/dist/src/components/data/nmorph-qr-code/types.d.ts +12 -0
  106. package/dist/src/components/data/nmorph-skeleton/NmorphSkeleton.vue.d.ts +2 -7
  107. package/dist/src/components/data/nmorph-skeleton/components/NmorphSkeletonItem.vue.d.ts +3 -9
  108. package/dist/src/components/data/nmorph-skeleton/components/types.d.ts +8 -0
  109. package/dist/src/components/data/nmorph-skeleton/types.d.ts +6 -0
  110. package/dist/src/components/data/nmorph-table/NmorphTable.vue.d.ts +3 -17
  111. package/dist/src/components/data/nmorph-table/components/nmorph-table-cell/NmorphTableCell.vue.d.ts +2 -4
  112. package/dist/src/components/data/nmorph-table/components/nmorph-table-cell/types.d.ts +3 -0
  113. package/dist/src/components/data/nmorph-table/components/nmorph-table-column/NmorphTableColumn.vue.d.ts +4 -5
  114. package/dist/src/components/data/nmorph-table/components/nmorph-table-column/types.d.ts +3 -0
  115. package/dist/src/components/data/nmorph-table/inner-components/nmorph-sort-button/NmorphSortButton.vue.d.ts +4 -6
  116. package/dist/src/components/data/nmorph-table/inner-components/nmorph-sort-button/types.d.ts +7 -0
  117. package/dist/src/components/data/nmorph-table/types.d.ts +15 -0
  118. package/dist/src/components/data/nmorph-tag-list/NmorphTagList.vue.d.ts +5 -8
  119. package/dist/src/components/data/nmorph-tag-list/components/nmorph-tag-item/NmorphTagItem.vue.d.ts +3 -5
  120. package/dist/src/components/data/nmorph-tag-list/components/nmorph-tag-item/types.d.ts +6 -0
  121. package/dist/src/components/data/nmorph-tag-list/types.d.ts +7 -0
  122. package/dist/src/components/data/nmorph-virtual-list/NmorphVirtualList.vue.d.ts +3 -14
  123. package/dist/src/components/data/nmorph-virtual-list/types.d.ts +15 -0
  124. package/dist/src/components/feedback/nmorph-alert/NmorphAlert.vue.d.ts +5 -7
  125. package/dist/src/components/feedback/nmorph-alert/types.d.ts +5 -0
  126. package/dist/src/components/feedback/nmorph-callout/NmorphCallout.vue.d.ts +3 -15
  127. package/dist/src/components/feedback/nmorph-callout/types.d.ts +12 -0
  128. package/dist/src/components/feedback/nmorph-dialog/NmorphDialog.vue.d.ts +4 -19
  129. package/dist/src/components/feedback/nmorph-dialog/types.d.ts +20 -0
  130. package/dist/src/components/feedback/nmorph-drawer/NmorphDrawer.vue.d.ts +4 -17
  131. package/dist/src/components/feedback/nmorph-drawer/types.d.ts +18 -0
  132. package/dist/src/components/feedback/nmorph-tooltip/NmorphTooltip.vue.d.ts +5 -14
  133. package/dist/src/components/feedback/nmorph-tooltip/types.d.ts +11 -0
  134. package/dist/src/components/form/nmorph-autocomplete/NmorphAutocomplete.vue.d.ts +6 -19
  135. package/dist/src/components/form/nmorph-autocomplete/types.d.ts +18 -0
  136. package/dist/src/components/form/nmorph-checkbox/NmorphCheckbox.vue.d.ts +1 -1
  137. package/dist/src/components/form/nmorph-checkbox/types.d.ts +3 -0
  138. package/dist/src/components/form/nmorph-checkbox-group/NmorphCheckboxGroup.vue.d.ts +5 -11
  139. package/dist/src/components/form/nmorph-checkbox-group/types.d.ts +11 -0
  140. package/dist/src/components/form/nmorph-color-picker/NmorphColorPicker.vue.d.ts +6 -11
  141. package/dist/src/components/form/nmorph-color-picker/types.d.ts +11 -0
  142. package/dist/src/components/form/nmorph-date-picker/NmorphDatePicker.vue.d.ts +5 -21
  143. package/dist/src/components/form/nmorph-date-picker/inner-components/nmorph-clear-button/types.d.ts +3 -0
  144. package/dist/src/components/form/nmorph-date-picker/inner-components/nmorph-date-picker-content/NmorphDatePickerContent.vue.d.ts +3 -8
  145. package/dist/src/components/form/nmorph-date-picker/inner-components/nmorph-date-picker-content/types.d.ts +10 -0
  146. package/dist/src/components/form/nmorph-date-picker/inner-components/nmorph-date-picker-header/NmorphDatePickerHeader.vue.d.ts +3 -6
  147. package/dist/src/components/form/nmorph-date-picker/inner-components/nmorph-date-picker-header/types.d.ts +12 -0
  148. package/dist/src/components/form/nmorph-date-picker/inner-components/nmorph-year-month-picker/NmorphYearMonthPicker.vue.d.ts +3 -6
  149. package/dist/src/components/form/nmorph-date-picker/inner-components/nmorph-year-month-picker/types.d.ts +9 -0
  150. package/dist/src/components/form/nmorph-date-picker/types.d.ts +21 -0
  151. package/dist/src/components/form/nmorph-file-upload/NmorphFileUpload.vue.d.ts +7 -12
  152. package/dist/src/components/form/nmorph-file-upload/types.d.ts +21 -0
  153. package/dist/src/components/form/nmorph-form/NmorphForm.vue.d.ts +4 -8
  154. package/dist/src/components/form/nmorph-form/components/nmorph-form-item/NmorphFormItem.vue.d.ts +3 -12
  155. package/dist/src/components/form/nmorph-form/components/nmorph-form-item/inner-components/nmorph-error-box/NmorphErrorBox.vue.d.ts +3 -8
  156. package/dist/src/components/form/nmorph-form/components/nmorph-form-item/inner-components/nmorph-error-box/types.d.ts +7 -0
  157. package/dist/src/components/form/nmorph-form/components/nmorph-form-item/inner-components/nmorph-validation-icon/NmorphValidationIcon.vue.d.ts +3 -6
  158. package/dist/src/components/form/nmorph-form/components/nmorph-form-item/inner-components/nmorph-validation-icon/types.d.ts +5 -0
  159. package/dist/src/components/form/nmorph-form/components/nmorph-form-item/types.d.ts +10 -0
  160. package/dist/src/components/form/nmorph-form/types.d.ts +21 -6
  161. package/dist/src/components/form/nmorph-form/use-form-item-input.d.ts +10 -0
  162. package/dist/src/components/form/nmorph-number-input/NmorphNumberInput.vue.d.ts +3 -10
  163. package/dist/src/components/form/nmorph-number-input/types.d.ts +11 -0
  164. package/dist/src/components/form/nmorph-otp-input/NmorphOTPInput.vue.d.ts +5 -13
  165. package/dist/src/components/form/nmorph-otp-input/types.d.ts +21 -0
  166. package/dist/src/components/form/nmorph-radio/NmorphRadio.vue.d.ts +4 -9
  167. package/dist/src/components/form/nmorph-radio/types.d.ts +6 -0
  168. package/dist/src/components/form/nmorph-radio-group/NmorphRadioGroup.vue.d.ts +4 -12
  169. package/dist/src/components/form/nmorph-radio-group/types.d.ts +12 -0
  170. package/dist/src/components/form/nmorph-select/NmorphSelect.vue.d.ts +3 -21
  171. package/dist/src/components/form/nmorph-select/components/nmorph-select-option/NmorphSelectOption.vue.d.ts +1 -1
  172. package/dist/src/components/form/nmorph-select/components/nmorph-select-option/types.d.ts +3 -0
  173. package/dist/src/components/form/nmorph-select/types.d.ts +21 -0
  174. package/dist/src/components/form/nmorph-select-button/NmorphSelectButton.vue.d.ts +4 -12
  175. package/dist/src/components/form/nmorph-select-button/components/nmorph-select-button-item/NmorphSelectButtonItem.vue.d.ts +3 -6
  176. package/dist/src/components/form/nmorph-select-button/components/nmorph-select-button-item/types.d.ts +4 -0
  177. package/dist/src/components/form/nmorph-select-button/types.d.ts +12 -0
  178. package/dist/src/components/form/nmorph-slider/NmorphSlider.vue.d.ts +111 -0
  179. package/dist/src/components/form/nmorph-slider/types.d.ts +3 -0
  180. package/dist/src/components/form/nmorph-switch/NmorphSwitch.vue.d.ts +3 -14
  181. package/dist/src/components/form/nmorph-switch/types.d.ts +15 -0
  182. package/dist/src/components/form/nmorph-text-input/NmorphTextInput.vue.d.ts +6 -14
  183. package/dist/src/components/form/nmorph-text-input/types.d.ts +16 -0
  184. package/dist/src/components/form/nmorph-textarea/NmorphTextarea.vue.d.ts +6 -18
  185. package/dist/src/components/form/nmorph-textarea/types.d.ts +20 -0
  186. package/dist/src/components/form/nmorph-time-picker/NmorphTimePicker.vue.d.ts +6 -20
  187. package/dist/src/components/form/nmorph-time-picker/types.d.ts +24 -0
  188. package/dist/src/components/navigation/index.d.ts +1 -1
  189. package/dist/src/components/navigation/nmorph-backtop/NmorphBacktop.vue.d.ts +4 -12
  190. package/dist/src/components/navigation/nmorph-backtop/types.d.ts +14 -0
  191. package/dist/src/components/navigation/nmorph-breadcrumb/NmorphBreadcrumb.vue.d.ts +2 -4
  192. package/dist/src/components/navigation/nmorph-breadcrumb/components/nmorph-breadcrumb-item/NmorphBreadcrumbItem.vue.d.ts +2 -4
  193. package/dist/src/components/navigation/nmorph-breadcrumb/components/nmorph-breadcrumb-item/types.d.ts +3 -0
  194. package/dist/src/components/navigation/nmorph-breadcrumb/types.d.ts +3 -0
  195. package/dist/src/components/navigation/nmorph-context-menu/NmorphContextMenu.vue.d.ts +10 -31
  196. package/dist/src/components/navigation/nmorph-context-menu/types.d.ts +42 -0
  197. package/dist/src/components/navigation/nmorph-dropdown/NmorphDropdown.vue.d.ts +6 -24
  198. package/dist/src/components/navigation/nmorph-dropdown/types.d.ts +24 -0
  199. package/dist/src/components/navigation/nmorph-tabs/NmorphTabs.vue.d.ts +4 -8
  200. package/dist/src/components/navigation/nmorph-tabs/components/nmorph-tab-pane/NmorphTabPane.vue.d.ts +4 -5
  201. package/dist/src/components/navigation/nmorph-tabs/components/nmorph-tab-pane/types.d.ts +3 -0
  202. package/dist/src/components/navigation/nmorph-tabs/{type.d.ts → types.d.ts} +9 -0
  203. package/dist/src/components/navigation/nmorph-tabs/utils.d.ts +1 -1
  204. package/dist/src/components/others/nmorph-divider/NmorphDivider.vue.d.ts +2 -5
  205. package/dist/src/components/others/nmorph-divider/types.d.ts +3 -0
  206. package/dist/src/components/others/nmorph-overlay/NmorphOverlay.vue.d.ts +3 -12
  207. package/dist/src/components/others/nmorph-overlay/types.d.ts +14 -0
  208. package/dist/src/components/providers/nmorph-notification-provider/NmorphNotificationProvider.vue.d.ts +2 -8
  209. package/dist/src/components/providers/nmorph-notification-provider/types.d.ts +9 -0
  210. package/dist/src/hooks/use-field-validation.d.ts +15 -0
  211. package/dist/src/hooks/use-focusable-input.d.ts +16 -0
  212. package/dist/src/hooks/use-form-validation.d.ts +4 -0
  213. package/dist/src/plugin.d.ts +4 -1
  214. package/dist/src/types/app.types.d.ts +21 -0
  215. package/dist/src/types/common.types.d.ts +62 -0
  216. package/dist/src/types/date.types.d.ts +7 -0
  217. package/dist/src/types/image.types.d.ts +17 -0
  218. package/dist/src/types/index.d.ts +8 -206
  219. package/dist/src/types/selection.types.d.ts +26 -0
  220. package/dist/src/types/table.types.d.ts +5 -0
  221. package/dist/src/types/theme.types.d.ts +55 -0
  222. package/dist/src/types/translation.types.d.ts +20 -0
  223. package/dist/src/utils/common.d.ts +3 -0
  224. package/dist/src/utils/file-types.d.ts +8 -0
  225. package/dist/src/utils/index.d.ts +1 -0
  226. package/dist/style.css +1 -1
  227. package/dist/types/common.types.js +14 -0
  228. package/dist/types/date.types.js +4 -0
  229. package/dist/types/image.types.js +5 -0
  230. package/dist/types/selection.types.js +4 -0
  231. package/dist/types/table.types.js +4 -0
  232. package/dist/types/translation.types.js +4 -0
  233. package/dist/utils/common.js +16 -7
  234. package/dist/utils/file-types.js +41 -0
  235. package/package.json +1 -1
  236. package/dist/src/components/data/nmorph-calendar/hooks/index.d.ts +0 -2
  237. package/dist/src/hooks/index.d.ts +0 -9
  238. package/dist/src/outside-hooks/index.d.ts +0 -5
  239. package/dist/types/index.js +0 -20
@@ -1,9 +1,10 @@
1
1
  import './NmorphTextarea.css';
2
- import { defineComponent as F, ref as h, computed as l, watch as B, onMounted as I, nextTick as T } from "vue";
3
- import { NmorphComponentHeight as O } from "../../../types/index.js";
4
- import { useModifiers as V } from "../../../utils/create-modifiers.js";
5
- import { useFormItemInput as j } from "../nmorph-form/use-form-item-input.js";
6
- const Y = /* @__PURE__ */ F({
2
+ import { defineComponent as B, computed as n, watch as C, onMounted as T, nextTick as V } from "vue";
3
+ import { useModifiers as O } from "../../../utils/create-modifiers.js";
4
+ import { useFocusableInput as j } from "../../../hooks/use-focusable-input.js";
5
+ import { useFormItemInput as k, useFormItemModel as P } from "../nmorph-form/use-form-item-input.js";
6
+ import { NmorphComponentHeight as A } from "../../../types/common.types.js";
7
+ const J = /* @__PURE__ */ B({
7
8
  __name: "NmorphTextarea",
8
9
  props: {
9
10
  placeholder: { type: String, required: !1, default: "" },
@@ -23,45 +24,50 @@ const Y = /* @__PURE__ */ F({
23
24
  tabindex: { type: Number, required: !1 }
24
25
  },
25
26
  emits: ["update:model-value", "focus", "blur", "on-enter", "keydown"],
26
- setup(y, { expose: g, emit: x }) {
27
- const e = y, n = x, { id: b, name: w, autocomplete: q, tabindex: v } = j(e), a = h(null), s = h(!1), S = l(
28
- () => V({
29
- nmorph: [O[e.height], s.value && "focused"],
27
+ setup(g, { expose: x, emit: b }) {
28
+ const e = g, r = b, { id: w, name: q, autocomplete: S, tabindex: v } = k(e), { modelValue: s, updateModelValue: l } = P(
29
+ e,
30
+ (t) => r("update:model-value", t),
31
+ ""
32
+ ), {
33
+ elementRef: i,
34
+ focused: u,
35
+ handleFocus: _,
36
+ handleBlur: z,
37
+ focus: d,
38
+ blur: p,
39
+ select: m
40
+ } = j({
41
+ onFocus: () => r("focus"),
42
+ onBlur: () => r("blur")
43
+ }), F = n(
44
+ () => O({
45
+ nmorph: [A[e.height], u.value && "focused"],
30
46
  "nmorph-textarea": [e.disabled && "disabled", e.autoSize && "auto-size"]
31
47
  })
32
- ), i = (t) => {
48
+ ), f = (t) => {
33
49
  const o = window.getComputedStyle(t);
34
50
  return parseFloat(o.paddingTop) + parseFloat(o.paddingBottom);
35
- }, r = async () => {
51
+ }, a = async () => {
36
52
  if (!e.autoSize) return;
37
- await T();
38
- const t = a.value;
53
+ await V();
54
+ const t = i.value;
39
55
  if (!t) return;
40
56
  t.style.height = "auto";
41
- const o = window.getComputedStyle(t), N = parseFloat(o.lineHeight) || 20, c = e.maxRows ? e.maxRows * N + i(t) : 1 / 0, C = Math.min(t.scrollHeight, c);
42
- t.style.height = `${C}px`, t.style.overflowY = t.scrollHeight > c ? "auto" : "hidden";
43
- }, _ = (t) => {
57
+ const o = window.getComputedStyle(t), I = parseFloat(o.lineHeight) || 20, y = e.maxRows ? e.maxRows * I + f(t) : 1 / 0, N = Math.min(t.scrollHeight, y);
58
+ t.style.height = `${N}px`, t.style.overflowY = t.scrollHeight > y ? "auto" : "hidden";
59
+ }, M = (t) => {
44
60
  const o = t.target;
45
- n("update:model-value", o.value), r();
46
- }, z = () => {
47
- n("focus"), s.value = !0;
48
- }, H = () => {
49
- n("blur"), s.value = !1;
50
- }, u = () => {
51
- a.value?.focus();
52
- }, d = () => {
53
- a.value?.blur();
54
- }, p = () => {
55
- a.value?.select();
61
+ l(o.value), a();
56
62
  };
57
- B(() => e.modelValue, r), I(r), g({ textareaDOMRef: a, focus: u, blur: d, select: p, resizeToContent: r });
58
- const f = l(() => Math.max(e.minRows, 1)), R = l(() => Math.max(e.rows, f.value)), M = l(() => ({
63
+ C(s, a), T(a), x({ textareaDOMRef: i, focus: d, blur: p, select: m, resizeToContent: a });
64
+ const c = n(() => Math.max(e.minRows, 1)), R = n(() => Math.max(e.rows, c.value)), H = n(() => ({
59
65
  "--nmorph-textarea-resize": e.autoSize ? "none" : e.resize,
60
66
  "--nmorph-textarea-indentation": e.indentation
61
- })), m = { props: e, emit: n, id: b, name: w, autocomplete: q, tabindex: v, textareaDOMRef: a, focused: s, modifiers: S, getVerticalPadding: i, resizeToContent: r, handleInput: _, handleFocus: z, handleBlur: H, focus: u, blur: d, select: p, minRows: f, rows: R, styles: M };
62
- return Object.defineProperty(m, "__isScriptSetup", { enumerable: !1, value: !0 }), m;
67
+ })), h = { props: e, emit: r, id: w, name: q, autocomplete: S, tabindex: v, modelValue: s, updateModelValue: l, textareaDOMRef: i, focused: u, handleFocus: _, handleBlur: z, focus: d, blur: p, select: m, modifiers: F, getVerticalPadding: f, resizeToContent: a, handleInput: M, minRows: c, rows: R, styles: H };
68
+ return Object.defineProperty(h, "__isScriptSetup", { enumerable: !1, value: !0 }), h;
63
69
  }
64
70
  });
65
71
  export {
66
- Y as default
72
+ J as default
67
73
  };
@@ -1,13 +1,13 @@
1
1
  import './NmorphTimePicker.css';
2
2
  import b from "./NmorphTimePicker.vue2.js";
3
- import { openBlock as i, createElementBlock as n, normalizeStyle as v, normalizeClass as l, createElementVNode as r, withKeys as m, withModifiers as t, createVNode as d, withCtx as p, toDisplayString as c, createCommentVNode as _, createBlock as f, Fragment as s, renderList as h } from "vue";
3
+ import { openBlock as i, createElementBlock as n, normalizeStyle as v, normalizeClass as a, createElementVNode as r, withKeys as m, withModifiers as t, createVNode as d, withCtx as p, toDisplayString as c, createCommentVNode as _, createBlock as f, Fragment as s, renderList as h } from "vue";
4
4
  /* empty css */
5
5
  import u from "../../../_virtual/_plugin-vue_export-helper.js";
6
- const y = ["aria-expanded", "aria-controls", "tabindex", "onKeydown"], w = ["id", "name", "autocomplete", "step", "value", "disabled"], x = { class: "nmorph-time-picker__selected-value" }, C = ["id"], g = {
6
+ const y = ["aria-expanded", "aria-controls", "tabindex", "onKeydown"], w = ["id", "name", "autocomplete", "step", "value", "disabled"], x = { class: "nmorph-time-picker__selected-value" }, C = ["id"], H = {
7
7
  class: "nmorph-time-picker__column",
8
8
  role: "listbox",
9
9
  "aria-label": "Hours"
10
- }, O = ["disabled", "onClick"], H = {
10
+ }, g = ["disabled", "onClick"], O = {
11
11
  class: "nmorph-time-picker__column",
12
12
  role: "listbox",
13
13
  "aria-label": "Minutes"
@@ -16,11 +16,11 @@ const y = ["aria-expanded", "aria-controls", "tabindex", "onKeydown"], w = ["id"
16
16
  role: "listbox",
17
17
  "aria-label": "Seconds"
18
18
  }, V = ["disabled", "onClick"];
19
- function I(S, a, z, e, B, D) {
19
+ function I(S, l, z, e, B, D) {
20
20
  return i(), n(
21
21
  "div",
22
22
  {
23
- class: l(e.modifiers),
23
+ class: a(e.modifiers),
24
24
  style: v(e.styles)
25
25
  },
26
26
  [
@@ -32,8 +32,8 @@ function I(S, a, z, e, B, D) {
32
32
  "aria-controls": `${e.id}-dropdown`,
33
33
  tabindex: e.props.disabled ? -1 : e.tabindex,
34
34
  onClick: e.toggleOpen,
35
- onFocus: e.focusHandler,
36
- onBlur: e.blurHandler,
35
+ onFocus: l[0] || (l[0] = (...o) => e.focusHandler && e.focusHandler(...o)),
36
+ onBlur: l[1] || (l[1] = (...o) => e.blurHandler && e.blurHandler(...o)),
37
37
  onKeydown: [
38
38
  m(t(e.toggleOpen, ["prevent"]), ["space"]),
39
39
  m(t(e.toggleOpen, ["prevent"]), ["enter"]),
@@ -47,7 +47,7 @@ function I(S, a, z, e, B, D) {
47
47
  autocomplete: e.autocomplete,
48
48
  type: "time",
49
49
  step: e.inputStep,
50
- value: e.props.modelValue || "",
50
+ value: e.modelValue || "",
51
51
  disabled: e.props.disabled,
52
52
  onInput: e.nativeInputHandler
53
53
  }, null, 40, w),
@@ -98,41 +98,41 @@ function I(S, a, z, e, B, D) {
98
98
  default: p(() => [
99
99
  r("div", {
100
100
  id: `${e.id}-dropdown`,
101
- class: l(["nmorph-time-picker__panel", { "nmorph-time-picker__panel--with-seconds": e.props.showSeconds }])
101
+ class: a(["nmorph-time-picker__panel", { "nmorph-time-picker__panel--with-seconds": e.props.showSeconds }])
102
102
  }, [
103
- r("div", g, [
103
+ r("div", H, [
104
104
  (i(!0), n(
105
105
  s,
106
106
  null,
107
107
  h(e.hourOptions, (o) => (i(), n("button", {
108
108
  key: o.value,
109
109
  type: "button",
110
- class: l(["nmorph-time-picker__option", [
110
+ class: a(["nmorph-time-picker__option", [
111
111
  e.optionHeightModifiers,
112
112
  { "nmorph-time-picker__option--active": o.value === e.pickerValue.hour }
113
113
  ]]),
114
114
  disabled: o.disabled,
115
115
  onClick: (k) => e.selectUnit("hour", o.value)
116
- }, c(o.label), 11, O))),
116
+ }, c(o.label), 11, g))),
117
117
  128
118
118
  /* KEYED_FRAGMENT */
119
119
  ))
120
120
  ]),
121
- a[1] || (a[1] = r(
121
+ l[3] || (l[3] = r(
122
122
  "div",
123
123
  { class: "nmorph-time-picker__separator" },
124
124
  ":",
125
125
  -1
126
126
  /* CACHED */
127
127
  )),
128
- r("div", H, [
128
+ r("div", O, [
129
129
  (i(!0), n(
130
130
  s,
131
131
  null,
132
132
  h(e.minuteOptions, (o) => (i(), n("button", {
133
133
  key: o.value,
134
134
  type: "button",
135
- class: l(["nmorph-time-picker__option", [
135
+ class: a(["nmorph-time-picker__option", [
136
136
  e.optionHeightModifiers,
137
137
  { "nmorph-time-picker__option--active": o.value === e.pickerValue.minute }
138
138
  ]]),
@@ -147,7 +147,7 @@ function I(S, a, z, e, B, D) {
147
147
  s,
148
148
  { key: 0 },
149
149
  [
150
- a[0] || (a[0] = r(
150
+ l[2] || (l[2] = r(
151
151
  "div",
152
152
  { class: "nmorph-time-picker__separator" },
153
153
  ":",
@@ -161,7 +161,7 @@ function I(S, a, z, e, B, D) {
161
161
  h(e.secondOptions, (o) => (i(), n("button", {
162
162
  key: o.value,
163
163
  type: "button",
164
- class: l(["nmorph-time-picker__option", [
164
+ class: a(["nmorph-time-picker__option", [
165
165
  e.optionHeightModifiers,
166
166
  { "nmorph-time-picker__option--active": o.value === e.pickerValue.second }
167
167
  ]]),
@@ -1,15 +1,16 @@
1
1
  import './NmorphTimePicker.css';
2
- import { defineComponent as Z, ref as v, computed as n, watch as ee } from "vue";
3
- import { NmorphComponentHeight as C } from "../../../types/index.js";
4
- import { useI18n as te } from "vue-i18n";
5
- import { useModifiers as _ } from "../../../utils/create-modifiers.js";
6
- import { toCssSize as oe } from "../../../utils/common.js";
7
- import { useFormItemInput as re } from "../nmorph-form/use-form-item-input.js";
8
- import ne from "../../../assets/icons/clock.svg.js";
9
- import le from "../../../assets/icons/circle-close.svg.js";
10
- import ue from "../../basic/nmorph-icon/NmorphIcon.vue.js";
11
- import ae from "../../navigation/nmorph-dropdown/NmorphDropdown.vue.js";
12
- const ve = /* @__PURE__ */ Z({
2
+ import { defineComponent as te, ref as _, computed as n, watch as oe } from "vue";
3
+ import { useI18n as re } from "vue-i18n";
4
+ import { useModifiers as O } from "../../../utils/create-modifiers.js";
5
+ import { createCssSizeVariables as ne } from "../../../utils/common.js";
6
+ import { useFocusableInput as ue } from "../../../hooks/use-focusable-input.js";
7
+ import { useFormItemInput as le, useFormItemModel as se } from "../nmorph-form/use-form-item-input.js";
8
+ import { NmorphComponentHeight as B } from "../../../types/common.types.js";
9
+ import ae from "../../../assets/icons/clock.svg.js";
10
+ import ie from "../../../assets/icons/circle-close.svg.js";
11
+ import de from "../../basic/nmorph-icon/NmorphIcon.vue.js";
12
+ import ce from "../../navigation/nmorph-dropdown/NmorphDropdown.vue.js";
13
+ const Ie = /* @__PURE__ */ te({
13
14
  __name: "NmorphTimePicker",
14
15
  props: {
15
16
  modelValue: { type: [String, null], required: !1, default: null },
@@ -31,86 +32,93 @@ const ve = /* @__PURE__ */ Z({
31
32
  tabindex: { type: Number, required: !1 }
32
33
  },
33
34
  emits: ["update:model-value", "focus", "blur"],
34
- setup(O, { expose: H, emit: k }) {
35
- const t = O, a = k, { t: T } = te(), { id: B, name: M, autocomplete: P, tabindex: $ } = re(t), s = v(!1), c = v(!1), w = v(null), m = (e) => String(e).padStart(2, "0"), p = (e) => Math.max(1, Math.floor(Number.isFinite(e) ? e : 1)), i = (e) => {
35
+ setup(H, { expose: M, emit: k }) {
36
+ const t = H, m = k, { t: I } = re(), { id: F, name: P, autocomplete: $, tabindex: z } = le(t), { modelValue: s, updateModelValue: p } = se(
37
+ t,
38
+ (e) => m("update:model-value", e),
39
+ null
40
+ ), a = _(!1), {
41
+ elementRef: T,
42
+ focused: w,
43
+ handleFocus: D,
44
+ handleBlur: R
45
+ } = ue({
46
+ onFocus: () => m("focus"),
47
+ onBlur: () => m("blur")
48
+ }), c = (e) => String(e).padStart(2, "0"), f = (e) => Math.max(1, Math.floor(Number.isFinite(e) ? e : 1)), i = (e) => {
36
49
  if (!e) return null;
37
50
  const o = e.match(/^(\d{1,2}):(\d{2})(?::(\d{2}))?$/);
38
51
  if (!o) return null;
39
- const r = Number(o[1]), b = Number(o[2]), d = Number(o[3] || 0);
40
- return r > 23 || b > 59 || d > 59 ? null : { hour: r, minute: b, second: d };
52
+ const r = Number(o[1]), v = Number(o[2]), d = Number(o[3] || 0);
53
+ return r > 23 || v > 59 || d > 59 ? null : { hour: r, minute: v, second: d };
41
54
  }, g = (e) => {
42
- const o = `${m(e.hour)}:${m(e.minute)}`;
43
- return t.showSeconds ? `${o}:${m(e.second)}` : o;
44
- }, f = (e) => e.hour * 3600 + e.minute * 60 + e.second, y = n(() => i(t.minTime)), N = n(() => i(t.maxTime)), V = n(() => i(t.modelValue)), u = v(V.value || { hour: 0, minute: 0, second: 0 }), x = n(() => t.placeholder || T("pickATime"));
45
- ee(
46
- () => t.modelValue,
47
- (e) => {
48
- const o = i(e);
49
- o && (u.value = o);
50
- }
51
- );
52
- const h = (e) => {
53
- const o = f(e);
54
- return !!(y.value && o < f(y.value) || N.value && o > f(N.value));
55
+ const o = `${c(e.hour)}:${c(e.minute)}`;
56
+ return t.showSeconds ? `${o}:${c(e.second)}` : o;
57
+ }, h = (e) => e.hour * 3600 + e.minute * 60 + e.second, y = n(() => i(t.minTime)), N = n(() => i(t.maxTime)), x = n(() => i(s.value)), l = _(x.value || { hour: 0, minute: 0, second: 0 }), C = n(() => t.placeholder || I("pickATime"));
58
+ oe(s, (e) => {
59
+ const o = i(e);
60
+ o && (l.value = o);
61
+ });
62
+ const b = (e) => {
63
+ const o = h(e);
64
+ return !!(y.value && o < h(y.value) || N.value && o > h(N.value));
55
65
  }, S = (e, o, r) => {
56
- const b = p(r), d = /* @__PURE__ */ new Set();
57
- for (let l = 0; l <= o; l += b) d.add(l);
58
- return d.add(u.value[e]), Array.from(d).filter((l) => l >= 0 && l <= o).sort((l, q) => l - q).map((l) => {
59
- const q = { ...u.value, [e]: l };
66
+ const v = f(r), d = /* @__PURE__ */ new Set();
67
+ for (let u = 0; u <= o; u += v) d.add(u);
68
+ return d.add(l.value[e]), Array.from(d).filter((u) => u >= 0 && u <= o).sort((u, q) => u - q).map((u) => {
69
+ const q = { ...l.value, [e]: u };
60
70
  return {
61
- label: m(l),
62
- value: l,
63
- disabled: h(q)
71
+ label: c(u),
72
+ value: u,
73
+ disabled: b(q)
64
74
  };
65
75
  });
66
- }, z = n(() => S("hour", 23, t.hourStep)), D = n(() => S("minute", 59, t.minuteStep)), A = n(() => S("second", 59, t.secondStep)), F = (e, o) => {
67
- const r = { ...u.value, [e]: o };
68
- h(r) || (u.value = r, a("update:model-value", g(r)));
69
- }, R = () => {
70
- a("update:model-value", null), s.value = !1;
71
- }, U = () => {
72
- s.value = !1;
73
- }, j = () => {
74
- t.disabled || (s.value = !s.value);
75
- }, E = () => {
76
- c.value = !0, a("focus");
76
+ }, A = n(() => S("hour", 23, t.hourStep)), U = n(() => S("minute", 59, t.minuteStep)), j = n(() => S("second", 59, t.secondStep)), E = (e, o) => {
77
+ const r = { ...l.value, [e]: o };
78
+ b(r) || (l.value = r, p(g(r)));
77
79
  }, G = () => {
78
- c.value = !1, a("blur");
79
- }, J = (e) => {
80
+ p(null), a.value = !1;
81
+ }, J = () => {
82
+ a.value = !1;
83
+ }, K = () => {
84
+ t.disabled || (a.value = !a.value);
85
+ }, L = (e) => {
80
86
  const o = e.target, r = i(o.value);
81
- !r || h(r) || (u.value = r, a("update:model-value", g(r)));
82
- }, K = n(() => t.modelValue || x.value), L = n(
83
- () => t.showSeconds ? p(t.secondStep) : p(t.minuteStep) * 60
84
- ), Q = n(() => t.clearable && !!t.modelValue && !t.disabled), W = n(
85
- () => _({
86
- nmorph: [C[t.height]],
87
+ !r || b(r) || (l.value = r, p(g(r)));
88
+ }, Q = n(() => s.value || C.value), W = n(
89
+ () => t.showSeconds ? f(t.secondStep) : f(t.minuteStep) * 60
90
+ ), X = n(() => t.clearable && !!s.value && !t.disabled), Y = n(
91
+ () => O({
92
+ nmorph: [B[t.height]],
87
93
  "nmorph-time-picker": [
88
94
  t.disabled && "disabled",
89
- s.value && "open",
90
- c.value && "focus",
91
- !t.modelValue && "placeholder"
95
+ a.value && "open",
96
+ w.value && "focus",
97
+ !s.value && "placeholder"
92
98
  ]
93
99
  })
94
- ), X = n(
95
- () => _({
96
- nmorph: [C[t.height]]
100
+ ), Z = n(
101
+ () => O({
102
+ nmorph: [B[t.height]]
97
103
  })
98
- ), Y = n(() => ({
99
- ...t.width !== void 0 && { "--width": oe(t.width) }
100
- }));
101
- H({ inputDOMRef: w });
102
- const I = { props: t, emit: a, t: T, id: B, name: M, autocomplete: P, tabindex: $, open: s, focused: c, inputDOMRef: w, pad: m, normalizeStep: p, parseTime: i, formatTime: g, timeToSeconds: f, minTimeParts: y, maxTimeParts: N, modelTimeParts: V, pickerValue: u, placeholderText: x, isOutsideRange: h, getUnitOptions: S, hourOptions: z, minuteOptions: D, secondOptions: A, selectUnit: F, clearHandler: R, closeHandler: U, toggleOpen: j, focusHandler: E, blurHandler: G, nativeInputHandler: J, displayValue: K, inputStep: L, showClearButton: Q, modifiers: W, optionHeightModifiers: X, styles: Y, get NmorphDropdown() {
103
- return ae;
104
+ ), ee = n(
105
+ () => ne({
106
+ "--width": t.width
107
+ })
108
+ );
109
+ M({ inputDOMRef: T });
110
+ const V = { props: t, emit: m, t: I, id: F, name: P, autocomplete: $, tabindex: z, modelValue: s, updateModelValue: p, open: a, inputDOMRef: T, focused: w, focusHandler: D, blurHandler: R, pad: c, normalizeStep: f, parseTime: i, formatTime: g, timeToSeconds: h, minTimeParts: y, maxTimeParts: N, modelTimeParts: x, pickerValue: l, placeholderText: C, isOutsideRange: b, getUnitOptions: S, hourOptions: A, minuteOptions: U, secondOptions: j, selectUnit: E, clearHandler: G, closeHandler: J, toggleOpen: K, nativeInputHandler: L, displayValue: Q, inputStep: W, showClearButton: X, modifiers: Y, optionHeightModifiers: Z, styles: ee, get NmorphDropdown() {
111
+ return ce;
104
112
  }, get NmorphIcon() {
105
- return ue;
113
+ return de;
106
114
  }, get NmorphIconCircleClose() {
107
- return le;
115
+ return ie;
108
116
  }, get NmorphIconClock() {
109
- return ne;
117
+ return ae;
110
118
  } };
111
- return Object.defineProperty(I, "__isScriptSetup", { enumerable: !1, value: !0 }), I;
119
+ return Object.defineProperty(V, "__isScriptSetup", { enumerable: !1, value: !0 }), V;
112
120
  }
113
121
  });
114
122
  export {
115
- ve as default
123
+ Ie as default
116
124
  };
@@ -1,10 +1,10 @@
1
1
  import './NmorphDropdown.css';
2
- import { defineComponent as w, ref as q, toRef as t, computed as l, watch as v } from "vue";
3
- import { useModifiers as b } from "../../../utils/create-modifiers.js";
4
- import { toCssSize as d } from "../../../utils/common.js";
5
- import { usePlacement as x } from "../../../hooks/use-placement.js";
2
+ import { defineComponent as y, ref as v, toRef as t, computed as i, watch as w } from "vue";
3
+ import { useModifiers as q } from "../../../utils/create-modifiers.js";
4
+ import { toCssSize as b, createCssSizeVariables as x } from "../../../utils/common.js";
5
+ import { usePlacement as S } from "../../../hooks/use-placement.js";
6
6
  import O from "../../others/nmorph-overlay/NmorphOverlay.vue.js";
7
- const B = /* @__PURE__ */ w({
7
+ const B = /* @__PURE__ */ y({
8
8
  __name: "NmorphDropdown",
9
9
  props: {
10
10
  open: { type: Boolean, required: !0 },
@@ -26,44 +26,46 @@ const B = /* @__PURE__ */ w({
26
26
  hideShadow: { type: Boolean, required: !1, default: !1 }
27
27
  },
28
28
  emits: ["on-outside-click", "on-escape-keydown"],
29
- setup(p, { expose: f, emit: m }) {
30
- f();
31
- const e = p, r = m, i = q(null), { placementCoords: o, placementReady: n, adjustPlacement: a } = x({
29
+ setup(u, { expose: p, emit: f }) {
30
+ p();
31
+ const e = u, r = f, l = v(null), { placementCoords: o, placementReady: d, adjustPlacement: a } = S({
32
32
  initialPlacement: t(e, "placement"),
33
- contentDOMElement: i,
33
+ contentDOMElement: l,
34
34
  relativeElement: t(e, "relativeElement"),
35
35
  yOffset: t(e, "yOffset"),
36
36
  xOffset: t(e, "xOffset"),
37
37
  enabled: t(e, "open")
38
- }), c = l(
39
- () => b({
38
+ }), m = i(
39
+ () => q({
40
40
  "nmorph-dropdown": [!e.open && "closed", e.hideShadow && "hide-shadow"]
41
41
  })
42
- ), s = l(
43
- () => e.fillWidth && e.relativeElement ? `${e.relativeElement.clientWidth}px` : d(e.width)
44
- ), h = l(() => ({
45
- "--nmorph-dropdown-width": s.value,
46
- "--nmorph-dropdown-min-width": d(e.minWidth) || "auto",
47
- "--nmorph-dropdown-max-width": d(e.maxWidth) || "none",
42
+ ), n = i(
43
+ () => e.fillWidth && e.relativeElement ? `${e.relativeElement.clientWidth}px` : b(e.width)
44
+ ), c = i(() => ({
45
+ "--nmorph-dropdown-width": n.value,
46
+ ...x({
47
+ "--nmorph-dropdown-min-width": e.minWidth === void 0 ? "auto" : e.minWidth,
48
+ "--nmorph-dropdown-max-width": e.maxWidth === void 0 ? "none" : e.maxWidth
49
+ }),
48
50
  left: o.value.x,
49
51
  top: o.value.y,
50
- visibility: e.open && n.value ? "visible" : "hidden"
52
+ visibility: e.open && d.value ? "visible" : "hidden"
51
53
  }));
52
- v(
54
+ w(
53
55
  () => e.open,
54
- (y) => {
55
- y && a();
56
+ (h) => {
57
+ h && a();
56
58
  },
57
59
  { flush: "post" }
58
60
  );
59
- const u = { props: e, emit: r, dropdownDOMRef: i, placementCoords: o, placementReady: n, adjustPlacement: a, modifiers: c, width: s, dropdownStyle: h, outsideClickHandler: () => {
61
+ const s = { props: e, emit: r, dropdownDOMRef: l, placementCoords: o, placementReady: d, adjustPlacement: a, modifiers: m, width: n, dropdownStyle: c, outsideClickHandler: () => {
60
62
  r("on-outside-click");
61
63
  }, escapeHandler: () => {
62
64
  r("on-escape-keydown");
63
65
  }, get NmorphOverlay() {
64
66
  return O;
65
67
  } };
66
- return Object.defineProperty(u, "__isScriptSetup", { enumerable: !1, value: !0 }), u;
68
+ return Object.defineProperty(s, "__isScriptSetup", { enumerable: !1, value: !0 }), s;
67
69
  }
68
70
  });
69
71
  export {
@@ -1,74 +1,87 @@
1
- import { ref as p } from "vue";
2
- const I = (b) => {
3
- const { inputValue: h, rules: a } = b, c = p([]), f = p(!1), d = p(!1);
1
+ import { isFileAllowedByTypes as z } from "../utils/file-types.js";
2
+ import { ref as h } from "vue";
3
+ const v = (n) => typeof File < "u" && n instanceof File, S = (n) => !!n && typeof n == "object" && "data" in n && v(n.data), I = (n) => {
4
+ if (v(n)) return [n];
5
+ if (!Array.isArray(n)) return null;
6
+ const u = n;
7
+ return u.length === 0 ? [] : u.every(v) ? u : u.every(S) ? u.map((l) => l.data) : null;
8
+ }, D = (n) => {
9
+ const { inputValue: u, rules: l } = n, p = h([]), y = h(!1), m = h(!1);
4
10
  return {
5
- touched: d,
6
- valid: f,
7
- errors: c,
11
+ touched: m,
12
+ valid: y,
13
+ errors: p,
8
14
  validate: () => {
9
- const y = a?.length > 0;
10
- if (!y) {
11
- f.value = !0;
15
+ const F = l?.length > 0;
16
+ if (p.value = [], !F) {
17
+ y.value = !0;
12
18
  return;
13
19
  }
14
- if (h === null) return;
15
- const t = h, u = (n) => y && n in a[0], m = typeof t == "string" && u("pattern"), v = typeof t == "number" && u("numberCompareType"), g = (typeof t == "string" || typeof t == "boolean") && u("booleanCompareType"), T = Array.isArray(t) && u("arrayCompareType");
16
- if (!v && !m && !g && !T) {
20
+ if (u === null) return;
21
+ const o = u, a = (s) => F && l.some((r) => s in r), T = typeof o == "string" && a("pattern"), g = typeof o == "number" && a("numberCompareType"), x = (typeof o == "string" || typeof o == "boolean") && a("booleanCompareType"), b = Array.isArray(o) && a("arrayCompareType"), w = a("fileMaxSize") || a("maxFileSize") || a("fileAllowedTypes") || a("allowedTypes") || a("fileMaxCount") || a("maxFiles"), A = w ? I(o) : null, C = w && A !== null;
22
+ if (!g && !T && !x && !b && !C) {
17
23
  console.warn("The input value and the provided rules do not match");
18
24
  return;
19
25
  }
20
- if (d.value || (d.value = !0), m) {
21
- const n = a;
22
- c.value = n.reduce((o, r) => (t.match(r.pattern) || o.push(r.error), o), []);
26
+ if (m.value || (m.value = !0), T) {
27
+ const s = l;
28
+ p.value = s.reduce((r, t) => (o.match(t.pattern) || r.push(t.error), r), []);
23
29
  }
24
- if (v) {
25
- const n = (r, e, s) => {
26
- switch (s) {
30
+ if (g) {
31
+ const s = (t, e, i) => {
32
+ switch (i) {
27
33
  case "eq":
28
- return r === e;
34
+ return t === e;
29
35
  case "gt":
30
- return r > e;
36
+ return t > e;
31
37
  case "lt":
32
- return r < e;
38
+ return t < e;
33
39
  case "lte":
34
- return r <= e;
40
+ return t <= e;
35
41
  case "gte":
36
- return r >= e;
42
+ return t >= e;
37
43
  }
38
- }, o = a;
39
- c.value = o.reduce((r, e) => (n(t, e.compareValue, e.numberCompareType) && r.push(e.error), r), []);
44
+ }, r = l;
45
+ p.value = r.reduce((t, e) => (s(o, e.compareValue, e.numberCompareType) && t.push(e.error), t), []);
40
46
  }
41
- if (g) {
42
- const n = a;
43
- c.value = n.reduce((o, r) => {
47
+ if (x) {
48
+ const s = l;
49
+ p.value = s.reduce((r, t) => {
44
50
  let e = !1;
45
- const { compareValue: s, booleanCompareType: i } = r;
46
- return i === "not-eq" && (e = t === s), i === "eq" && (e = t !== s), e || o.push(r.error), o;
51
+ const { compareValue: i, booleanCompareType: f } = t;
52
+ return f === "not-eq" && (e = o === i), f === "eq" && (e = o !== i), e || r.push(t.error), r;
47
53
  }, []);
48
54
  }
49
- if (T) {
50
- const n = a, o = (r, e, s) => {
51
- switch (s) {
55
+ if (b) {
56
+ const s = l, r = (t, e, i) => {
57
+ switch (i) {
52
58
  case "contains-one":
53
- return r.some((l) => e.includes(l));
59
+ return t.some((c) => e.includes(c));
54
60
  case "full-eq":
55
- if (r.length !== e.length) return !1;
56
- const i = [...r].sort(), C = [...e].sort();
57
- return i.every((l, w) => l === C[w]);
61
+ if (t.length !== e.length) return !1;
62
+ const f = [...t].sort(), d = [...e].sort();
63
+ return f.every((c, R) => c === d[R]);
58
64
  case "not-contains":
59
- return !r.some((l) => e.includes(l));
65
+ return !t.some((c) => e.includes(c));
60
66
  }
61
67
  };
62
- c.value = n.reduce((r, e) => (o(
63
- t.map((i) => String(i)),
68
+ p.value = s.reduce((t, e) => (r(
69
+ o.map((f) => String(f)),
64
70
  e.compareValue,
65
71
  e.arrayCompareType
66
- ) || r.push(e.error), r), []);
72
+ ) || t.push(e.error), t), []);
73
+ }
74
+ if (C) {
75
+ const s = l, r = A || [];
76
+ p.value = s.reduce((t, e) => {
77
+ const i = e.fileMaxSize ?? e.maxFileSize, f = e.fileAllowedTypes ?? e.allowedTypes, d = e.fileMaxCount ?? e.maxFiles;
78
+ return typeof i == "number" && r.some((c) => c.size > i) && t.push(e.error), f && r.some((c) => !z(c, f)) && t.push(e.error), typeof d == "number" && r.length > d && t.push(e.error), t;
79
+ }, []);
67
80
  }
68
- f.value = c.value.length === 0;
81
+ y.value = p.value.length === 0;
69
82
  }
70
83
  };
71
84
  };
72
85
  export {
73
- I as useFieldValidation
86
+ D as useFieldValidation
74
87
  };