@movk/nuxt 1.2.0 → 1.3.0

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 (293) hide show
  1. package/.nuxt/movk-ui.css +3 -0
  2. package/README.md +74 -79
  3. package/dist/module.d.mts +57 -1
  4. package/dist/module.json +2 -2
  5. package/dist/module.mjs +120 -126
  6. package/dist/runtime/components/AutoForm.d.vue.ts +10 -30
  7. package/dist/runtime/components/AutoForm.vue +114 -125
  8. package/dist/runtime/components/AutoForm.vue.d.ts +10 -30
  9. package/dist/runtime/components/ColorChooser.d.vue.ts +21 -22
  10. package/dist/runtime/components/ColorChooser.vue +304 -27
  11. package/dist/runtime/components/ColorChooser.vue.d.ts +21 -22
  12. package/dist/runtime/components/DataTable.d.vue.ts +57 -0
  13. package/dist/runtime/components/DataTable.vue +584 -0
  14. package/dist/runtime/components/DataTable.vue.d.ts +57 -0
  15. package/dist/runtime/components/DatePicker.d.vue.ts +20 -33
  16. package/dist/runtime/components/DatePicker.vue +173 -65
  17. package/dist/runtime/components/DatePicker.vue.d.ts +20 -33
  18. package/dist/runtime/components/MessageBox.d.vue.ts +36 -0
  19. package/dist/runtime/components/MessageBox.vue +113 -0
  20. package/dist/runtime/components/MessageBox.vue.d.ts +36 -0
  21. package/dist/runtime/components/PillGroup.d.vue.ts +33 -0
  22. package/dist/runtime/components/PillGroup.vue +291 -0
  23. package/dist/runtime/components/PillGroup.vue.d.ts +33 -0
  24. package/dist/runtime/components/Popconfirm.d.vue.ts +30 -0
  25. package/dist/runtime/components/Popconfirm.vue +143 -0
  26. package/dist/runtime/components/Popconfirm.vue.d.ts +30 -0
  27. package/dist/runtime/components/SearchForm.d.vue.ts +21 -149
  28. package/dist/runtime/components/SearchForm.vue +211 -153
  29. package/dist/runtime/components/SearchForm.vue.d.ts +21 -149
  30. package/dist/runtime/components/SlideVerify.d.vue.ts +31 -70
  31. package/dist/runtime/components/SlideVerify.vue +117 -90
  32. package/dist/runtime/components/SlideVerify.vue.d.ts +31 -70
  33. package/dist/runtime/components/StarRating.d.vue.ts +38 -87
  34. package/dist/runtime/components/StarRating.vue +118 -74
  35. package/dist/runtime/components/StarRating.vue.d.ts +38 -87
  36. package/dist/runtime/components/input/AsPhoneNumberInput.d.vue.ts +11 -15
  37. package/dist/runtime/components/input/AsPhoneNumberInput.vue +22 -9
  38. package/dist/runtime/components/input/AsPhoneNumberInput.vue.d.ts +11 -15
  39. package/dist/runtime/components/input/WithCharacterLimit.d.vue.ts +11 -13
  40. package/dist/runtime/components/input/WithCharacterLimit.vue +23 -11
  41. package/dist/runtime/components/input/WithCharacterLimit.vue.d.ts +11 -13
  42. package/dist/runtime/components/input/WithClear.d.vue.ts +13 -11
  43. package/dist/runtime/components/input/WithClear.vue +27 -8
  44. package/dist/runtime/components/input/WithClear.vue.d.ts +13 -11
  45. package/dist/runtime/components/input/WithCopy.d.vue.ts +13 -13
  46. package/dist/runtime/components/input/WithCopy.vue +25 -8
  47. package/dist/runtime/components/input/WithCopy.vue.d.ts +13 -13
  48. package/dist/runtime/components/input/WithFloatingLabel.d.vue.ts +13 -16
  49. package/dist/runtime/components/input/WithFloatingLabel.vue +35 -27
  50. package/dist/runtime/components/input/WithFloatingLabel.vue.d.ts +13 -16
  51. package/dist/runtime/components/input/WithPasswordToggle.d.vue.ts +11 -7
  52. package/dist/runtime/components/input/WithPasswordToggle.vue +24 -7
  53. package/dist/runtime/components/input/WithPasswordToggle.vue.d.ts +11 -7
  54. package/dist/runtime/components/theme-picker/ThemePicker.d.vue.ts +8 -1
  55. package/dist/runtime/components/theme-picker/ThemePicker.vue +27 -12
  56. package/dist/runtime/components/theme-picker/ThemePicker.vue.d.ts +8 -1
  57. package/dist/runtime/components/theme-picker/ThemePickerButton.d.vue.ts +9 -4
  58. package/dist/runtime/components/theme-picker/ThemePickerButton.vue +4 -0
  59. package/dist/runtime/components/theme-picker/ThemePickerButton.vue.d.ts +9 -4
  60. package/dist/runtime/composables/index.d.ts +9 -8
  61. package/dist/runtime/composables/index.js +1 -0
  62. package/dist/runtime/composables/useApiFetch.d.ts +10 -5
  63. package/dist/runtime/composables/useApiFetch.js +20 -2
  64. package/dist/runtime/composables/useAutoForm.d.ts +4 -4
  65. package/dist/runtime/composables/useAutoForm.js +23 -9
  66. package/dist/runtime/composables/useClientApiFetch.d.ts +3 -2
  67. package/dist/runtime/composables/useDateFormatter.d.ts +16 -3
  68. package/dist/runtime/composables/useDateFormatter.js +89 -30
  69. package/dist/runtime/composables/useDownloadWithProgress.d.ts +26 -27
  70. package/dist/runtime/composables/useDownloadWithProgress.js +142 -40
  71. package/dist/runtime/composables/useLazyApiFetch.d.ts +3 -2
  72. package/dist/runtime/composables/useMessageBox.d.ts +6 -0
  73. package/dist/runtime/composables/useMessageBox.js +16 -0
  74. package/dist/runtime/composables/useTheme.d.ts +26 -16
  75. package/dist/runtime/composables/useTheme.js +98 -71
  76. package/dist/runtime/composables/useUploadWithProgress.d.ts +23 -29
  77. package/dist/runtime/composables/useUploadWithProgress.js +78 -67
  78. package/dist/runtime/domains/api/auth.d.ts +2 -0
  79. package/dist/runtime/domains/api/auth.js +31 -0
  80. package/dist/runtime/domains/api/endpoint-config.d.ts +11 -0
  81. package/dist/runtime/domains/api/endpoint-config.js +17 -0
  82. package/dist/runtime/domains/api/errors.d.ts +2 -0
  83. package/dist/runtime/domains/api/errors.js +10 -0
  84. package/dist/runtime/domains/api/fetch-key.d.ts +20 -0
  85. package/dist/runtime/domains/api/fetch-key.js +23 -0
  86. package/dist/runtime/domains/api/interceptors/error.d.ts +13 -0
  87. package/dist/runtime/domains/api/interceptors/error.js +49 -0
  88. package/dist/runtime/domains/api/interceptors/request.d.ts +12 -0
  89. package/dist/runtime/domains/api/interceptors/request.js +46 -0
  90. package/dist/runtime/domains/api/interceptors/response.d.ts +17 -0
  91. package/dist/runtime/domains/api/interceptors/response.js +27 -0
  92. package/dist/runtime/domains/api/response.d.ts +4 -0
  93. package/dist/runtime/domains/api/response.js +14 -0
  94. package/dist/runtime/domains/api/toast.d.ts +15 -0
  95. package/dist/runtime/domains/api/toast.js +46 -0
  96. package/dist/runtime/domains/api/transfer.d.ts +69 -0
  97. package/dist/runtime/domains/api/transfer.js +81 -0
  98. package/dist/runtime/domains/auto-form/actions.d.ts +2 -0
  99. package/dist/runtime/domains/auto-form/actions.js +4 -0
  100. package/dist/runtime/domains/auto-form/components/Array.d.vue.ts +13 -0
  101. package/dist/runtime/{components/auto-form-renderer/AutoFormRendererArray.vue → domains/auto-form/components/Array.vue} +25 -29
  102. package/dist/runtime/domains/auto-form/components/Array.vue.d.ts +13 -0
  103. package/dist/runtime/domains/auto-form/components/Children.d.vue.ts +11 -0
  104. package/dist/runtime/{components/auto-form-renderer/AutoFormRendererChildren.vue → domains/auto-form/components/Children.vue} +18 -18
  105. package/dist/runtime/domains/auto-form/components/Children.vue.d.ts +11 -0
  106. package/dist/runtime/domains/auto-form/components/Field.d.vue.ts +11 -0
  107. package/dist/runtime/domains/auto-form/components/Field.vue +56 -0
  108. package/dist/runtime/domains/auto-form/components/Field.vue.d.ts +11 -0
  109. package/dist/runtime/domains/auto-form/components/Layout.d.vue.ts +11 -0
  110. package/dist/runtime/{components/auto-form-renderer/AutoFormRendererLayout.vue → domains/auto-form/components/Layout.vue} +24 -25
  111. package/dist/runtime/domains/auto-form/components/Layout.vue.d.ts +11 -0
  112. package/dist/runtime/domains/auto-form/components/Nested.d.vue.ts +11 -0
  113. package/dist/runtime/{components/auto-form-renderer/AutoFormRendererNested.vue → domains/auto-form/components/Nested.vue} +17 -21
  114. package/dist/runtime/domains/auto-form/components/Nested.vue.d.ts +11 -0
  115. package/dist/runtime/domains/auto-form/controls.d.ts +41 -0
  116. package/dist/runtime/{auto-form → domains/auto-form}/controls.js +27 -24
  117. package/dist/runtime/{auto-form/field-utils.d.ts → domains/auto-form/fields.d.ts} +3 -1
  118. package/dist/runtime/{auto-form/field-utils.js → domains/auto-form/fields.js} +18 -2
  119. package/dist/runtime/{auto-form → domains/auto-form}/metadata.js +1 -1
  120. package/dist/runtime/domains/auto-form/provider.d.ts +62 -0
  121. package/dist/runtime/{auto-form → domains/auto-form}/provider.js +6 -3
  122. package/dist/runtime/{auto-form/reactive-utils.d.ts → domains/auto-form/reactive.d.ts} +5 -5
  123. package/dist/runtime/{auto-form/reactive-utils.js → domains/auto-form/reactive.js} +1 -1
  124. package/dist/runtime/{auto-form/schema-introspector.d.ts → domains/auto-form/schema.d.ts} +2 -2
  125. package/dist/runtime/{auto-form/schema-introspector.js → domains/auto-form/schema.js} +1 -1
  126. package/dist/runtime/domains/data-table/columns/constants.d.ts +50 -0
  127. package/dist/runtime/domains/data-table/columns/constants.js +19 -0
  128. package/dist/runtime/domains/data-table/columns/resolve-columns.d.ts +4 -0
  129. package/dist/runtime/domains/data-table/columns/resolve-columns.js +59 -0
  130. package/dist/runtime/domains/data-table/columns/resolve-data-column.d.ts +9 -0
  131. package/dist/runtime/domains/data-table/columns/resolve-data-column.js +164 -0
  132. package/dist/runtime/domains/data-table/columns/resolve-group-column.d.ts +4 -0
  133. package/dist/runtime/domains/data-table/columns/resolve-group-column.js +19 -0
  134. package/dist/runtime/domains/data-table/columns/resolve-special-columns.d.ts +8 -0
  135. package/dist/runtime/domains/data-table/columns/resolve-special-columns.js +232 -0
  136. package/dist/runtime/domains/data-table/columns/style.d.ts +11 -0
  137. package/dist/runtime/domains/data-table/columns/style.js +67 -0
  138. package/dist/runtime/domains/data-table/columns/utils.d.ts +6 -0
  139. package/dist/runtime/domains/data-table/columns/utils.js +16 -0
  140. package/dist/runtime/domains/data-table/components/ActionConfirm.d.vue.ts +10 -0
  141. package/dist/runtime/domains/data-table/components/ActionConfirm.vue +39 -0
  142. package/dist/runtime/domains/data-table/components/ActionConfirm.vue.d.ts +10 -0
  143. package/dist/runtime/domains/data-table/components/ActionsCell.d.vue.ts +11 -0
  144. package/dist/runtime/domains/data-table/components/ActionsCell.vue +91 -0
  145. package/dist/runtime/domains/data-table/components/ActionsCell.vue.d.ts +11 -0
  146. package/dist/runtime/domains/data-table/components/CellTooltip.d.vue.ts +9 -0
  147. package/dist/runtime/domains/data-table/components/CellTooltip.vue +40 -0
  148. package/dist/runtime/domains/data-table/components/CellTooltip.vue.d.ts +9 -0
  149. package/dist/runtime/domains/data-table/components/Pagination.d.vue.ts +26 -0
  150. package/dist/runtime/domains/data-table/components/Pagination.vue +132 -0
  151. package/dist/runtime/domains/data-table/components/Pagination.vue.d.ts +26 -0
  152. package/dist/runtime/domains/data-table/indent.d.ts +8 -0
  153. package/dist/runtime/domains/data-table/indent.js +19 -0
  154. package/dist/runtime/domains/data-table/tree-selection.d.ts +9 -0
  155. package/dist/runtime/domains/data-table/tree-selection.js +76 -0
  156. package/dist/runtime/{utils/theme.d.ts → domains/theme/theme-icons.d.ts} +0 -1
  157. package/dist/runtime/index.css +1 -0
  158. package/dist/runtime/plugins/api.factory.js +17 -117
  159. package/dist/runtime/plugins/theme.js +49 -27
  160. package/dist/runtime/types/api/config.d.ts +127 -0
  161. package/dist/runtime/types/api/fetch.d.ts +50 -0
  162. package/dist/runtime/types/api/index.d.ts +5 -0
  163. package/dist/runtime/types/api/module.d.ts +94 -0
  164. package/dist/runtime/types/api/response.d.ts +62 -0
  165. package/dist/runtime/types/api/response.js +0 -0
  166. package/dist/runtime/types/api/transfer.d.ts +32 -0
  167. package/dist/runtime/types/api/transfer.js +0 -0
  168. package/dist/runtime/types/app.config.d.ts +6 -0
  169. package/dist/runtime/types/auto-form/base.d.ts +26 -0
  170. package/dist/runtime/types/auto-form/base.js +0 -0
  171. package/dist/runtime/types/auto-form/component.d.ts +28 -0
  172. package/dist/runtime/types/auto-form/component.js +0 -0
  173. package/dist/runtime/types/auto-form/controls.d.ts +45 -0
  174. package/dist/runtime/types/auto-form/controls.js +0 -0
  175. package/dist/runtime/types/auto-form/fields.d.ts +68 -0
  176. package/dist/runtime/types/auto-form/fields.js +0 -0
  177. package/dist/runtime/types/auto-form/index.d.ts +7 -0
  178. package/dist/runtime/types/auto-form/index.js +0 -0
  179. package/dist/runtime/types/auto-form/search-form.d.ts +84 -0
  180. package/dist/runtime/types/auto-form/search-form.js +0 -0
  181. package/dist/runtime/types/auto-form/slots.d.ts +85 -0
  182. package/dist/runtime/types/auto-form/slots.js +0 -0
  183. package/dist/runtime/types/auto-form/zod-factory.d.ts +127 -0
  184. package/dist/runtime/types/auto-form/zod-factory.js +0 -0
  185. package/dist/runtime/types/components/color-chooser.d.ts +109 -0
  186. package/dist/runtime/types/components/color-chooser.js +0 -0
  187. package/dist/runtime/types/components/date-picker.d.ts +41 -0
  188. package/dist/runtime/types/components/date-picker.js +0 -0
  189. package/dist/runtime/types/components/index.d.ts +8 -0
  190. package/dist/runtime/types/components/index.js +0 -0
  191. package/dist/runtime/types/components/input/as-phone-number-input.d.ts +17 -0
  192. package/dist/runtime/types/components/input/as-phone-number-input.js +0 -0
  193. package/dist/runtime/types/components/input/index.d.ts +6 -0
  194. package/dist/runtime/types/components/input/index.js +0 -0
  195. package/dist/runtime/types/components/input/with-character-limit.d.ts +11 -0
  196. package/dist/runtime/types/components/input/with-character-limit.js +0 -0
  197. package/dist/runtime/types/components/input/with-clear.d.ts +10 -0
  198. package/dist/runtime/types/components/input/with-clear.js +0 -0
  199. package/dist/runtime/types/components/input/with-copy.d.ts +11 -0
  200. package/dist/runtime/types/components/input/with-copy.js +0 -0
  201. package/dist/runtime/types/components/input/with-floating-label.d.ts +12 -0
  202. package/dist/runtime/types/components/input/with-floating-label.js +0 -0
  203. package/dist/runtime/types/components/input/with-password-toggle.d.ts +7 -0
  204. package/dist/runtime/types/components/input/with-password-toggle.js +0 -0
  205. package/dist/runtime/types/components/message-box.d.ts +69 -0
  206. package/dist/runtime/types/components/message-box.js +0 -0
  207. package/dist/runtime/types/components/pill-group.d.ts +103 -0
  208. package/dist/runtime/types/components/pill-group.js +0 -0
  209. package/dist/runtime/types/components/popconfirm.d.ts +74 -0
  210. package/dist/runtime/types/components/popconfirm.js +0 -0
  211. package/dist/runtime/types/components/slide-verify.d.ts +54 -0
  212. package/dist/runtime/types/components/slide-verify.js +0 -0
  213. package/dist/runtime/types/components/star-rating.d.ts +55 -0
  214. package/dist/runtime/types/components/star-rating.js +0 -0
  215. package/dist/runtime/types/data-table/columns.d.ts +236 -0
  216. package/dist/runtime/types/data-table/columns.js +6 -0
  217. package/dist/runtime/types/data-table/component.d.ts +190 -0
  218. package/dist/runtime/types/data-table/component.js +0 -0
  219. package/dist/runtime/types/data-table/contexts.d.ts +44 -0
  220. package/dist/runtime/types/data-table/contexts.js +0 -0
  221. package/dist/runtime/types/data-table/index.d.ts +6 -0
  222. package/dist/runtime/types/data-table/index.js +1 -0
  223. package/dist/runtime/types/data-table/pagination.d.ts +87 -0
  224. package/dist/runtime/types/data-table/pagination.js +0 -0
  225. package/dist/runtime/types/index.d.ts +6 -5
  226. package/dist/runtime/types/index.js +5 -5
  227. package/dist/runtime/types/shared.d.ts +5 -0
  228. package/dist/runtime/types/shared.js +0 -0
  229. package/dist/runtime/types/zod.d.ts +11 -10
  230. package/dist/runtime/utils/extend-theme.d.ts +19 -0
  231. package/dist/runtime/utils/extend-theme.js +44 -0
  232. package/dist/runtime/utils/form-control.d.ts +33 -0
  233. package/dist/runtime/utils/form-control.js +54 -0
  234. package/dist/runtime/utils/meta.d.ts +2 -5
  235. package/dist/runtime/utils/meta.js +1 -3
  236. package/dist/runtime/utils/theme-defaults.d.ts +27 -0
  237. package/dist/runtime/utils/theme-defaults.js +28 -0
  238. package/dist/runtime/utils/tv.d.ts +1 -0
  239. package/dist/runtime/utils/tv.js +4 -0
  240. package/dist/runtime/vue/composables/useSiteConfig.d.ts +13 -0
  241. package/dist/runtime/vue/composables/useSiteConfig.js +11 -0
  242. package/dist/runtime/vue/plugins/theme.d.ts +6 -0
  243. package/dist/runtime/vue/plugins/theme.js +14 -0
  244. package/dist/runtime/vue/stubs/base.d.ts +2 -0
  245. package/dist/runtime/vue/stubs/base.js +2 -0
  246. package/dist/runtime/vue/stubs/inertia.d.ts +2 -0
  247. package/dist/runtime/vue/stubs/inertia.js +2 -0
  248. package/dist/runtime/vue/stubs/movk-extra.d.ts +2 -0
  249. package/dist/runtime/vue/stubs/movk-extra.js +2 -0
  250. package/dist/runtime/vue/stubs/none.d.ts +2 -0
  251. package/dist/runtime/vue/stubs/none.js +2 -0
  252. package/dist/runtime/vue/stubs/vue-router.d.ts +2 -0
  253. package/dist/runtime/vue/stubs/vue-router.js +2 -0
  254. package/dist/shared/nuxt.DfBEyjld.mjs +667 -0
  255. package/dist/types.d.mts +2 -6
  256. package/dist/unplugin.d.mts +28 -0
  257. package/dist/unplugin.mjs +292 -0
  258. package/dist/vite.d.mts +12 -0
  259. package/dist/vite.mjs +20 -0
  260. package/package.json +75 -36
  261. package/vue-plugin.d.ts +5 -0
  262. package/dist/runtime/auto-form/controls.d.ts +0 -221
  263. package/dist/runtime/auto-form/provider.d.ts +0 -27
  264. package/dist/runtime/components/auto-form-renderer/AutoFormRendererArray.d.vue.ts +0 -28
  265. package/dist/runtime/components/auto-form-renderer/AutoFormRendererArray.vue.d.ts +0 -28
  266. package/dist/runtime/components/auto-form-renderer/AutoFormRendererChildren.d.vue.ts +0 -26
  267. package/dist/runtime/components/auto-form-renderer/AutoFormRendererChildren.vue.d.ts +0 -26
  268. package/dist/runtime/components/auto-form-renderer/AutoFormRendererField.d.vue.ts +0 -26
  269. package/dist/runtime/components/auto-form-renderer/AutoFormRendererField.vue +0 -55
  270. package/dist/runtime/components/auto-form-renderer/AutoFormRendererField.vue.d.ts +0 -26
  271. package/dist/runtime/components/auto-form-renderer/AutoFormRendererLayout.d.vue.ts +0 -26
  272. package/dist/runtime/components/auto-form-renderer/AutoFormRendererLayout.vue.d.ts +0 -26
  273. package/dist/runtime/components/auto-form-renderer/AutoFormRendererNested.d.vue.ts +0 -26
  274. package/dist/runtime/components/auto-form-renderer/AutoFormRendererNested.vue.d.ts +0 -26
  275. package/dist/runtime/constants/api-defaults.d.ts +0 -9
  276. package/dist/runtime/constants/api-defaults.js +0 -32
  277. package/dist/runtime/constants/grid-cols.d.ts +0 -7
  278. package/dist/runtime/constants/grid-cols.js +0 -44
  279. package/dist/runtime/style.css +0 -1
  280. package/dist/runtime/types/api.d.ts +0 -349
  281. package/dist/runtime/types/auto-form.d.ts +0 -259
  282. package/dist/runtime/types/module.d.ts +0 -96
  283. package/dist/runtime/types/theme.d.ts +0 -2
  284. package/dist/runtime/utils/api-utils.d.ts +0 -58
  285. package/dist/runtime/utils/api-utils.js +0 -98
  286. /package/dist/runtime/{constants/auto-form.d.ts → domains/auto-form/constants.d.ts} +0 -0
  287. /package/dist/runtime/{constants/auto-form.js → domains/auto-form/constants.js} +0 -0
  288. /package/dist/runtime/{auto-form → domains/auto-form}/metadata.d.ts +0 -0
  289. /package/dist/runtime/{utils/theme.js → domains/theme/theme-icons.js} +0 -0
  290. /package/dist/runtime/types/{api.js → api/config.js} +0 -0
  291. /package/dist/runtime/types/{auto-form.js → api/fetch.js} +0 -0
  292. /package/dist/runtime/types/{module.js → api/index.js} +0 -0
  293. /package/dist/runtime/types/{theme.js → api/module.js} +0 -0
@@ -1,51 +1,328 @@
1
1
  <script setup>
2
- import { UPopover, UButton, UColorPicker, UIcon } from "#components";
3
- import { computed } from "vue";
2
+ import { computed, ref, useAttrs, watch } from "vue";
3
+ import { useClipboard } from "@vueuse/core";
4
+ import { ColorTranslator } from "colortranslator";
5
+ import { UPopover, UButton, UColorPicker, UIcon, UInput } from "#components";
6
+ import { useAppConfig } from "#imports";
7
+ import { useExtendedTv } from "../utils/extend-theme";
8
+ import { useFieldControl } from "../utils/form-control";
9
+ import theme from "#build/movk-ui/color-chooser";
10
+ import popoverTheme from "#build/ui/popover";
11
+ import PillGroup from "./PillGroup.vue";
4
12
  const props = defineProps({
5
- popoverProps: { type: Object, required: false },
6
- buttonProps: { type: Object, required: false }
13
+ id: { type: String, required: false },
14
+ name: { type: String, required: false },
15
+ format: { type: String, required: false, default: "hex" },
16
+ formats: { type: Array, required: false, default: () => ["hex"] },
17
+ swatches: { type: Array, required: false },
18
+ closeOnSwatch: { type: Boolean, required: false, default: true },
19
+ clearable: { type: Boolean, required: false },
20
+ copyable: { type: Boolean, required: false },
21
+ trigger: { type: String, required: false, default: "button" },
22
+ label: { type: String, required: false },
23
+ placeholder: { type: String, required: false, default: "\u9009\u62E9\u989C\u8272" },
24
+ size: { type: void 0, required: false },
25
+ color: { type: null, required: false, default: "neutral" },
26
+ variant: { type: null, required: false, default: "subtle" },
27
+ disabled: { type: Boolean, required: false },
28
+ highlight: { type: Boolean, required: false },
29
+ icon: { type: null, required: false, default: "i-lucide-palette" },
30
+ colorPickerProps: { type: Object, required: false },
31
+ ui: { type: Object, required: false }
7
32
  });
8
- const emit = defineEmits(["close:prevent", "update:open"]);
9
- defineOptions({ inheritAttrs: false });
10
33
  const modelValue = defineModel({ type: String });
11
- const label = computed(() => {
12
- return modelValue.value || props.buttonProps?.label || "\u9009\u62E9\u989C\u8272";
34
+ const emits = defineEmits(["update:modelValue", "update:open", "change", "clear", "copy", "format-change"]);
35
+ const slots = defineSlots();
36
+ defineOptions({ inheritAttrs: false });
37
+ const attrs = useAttrs();
38
+ const appConfig = useAppConfig();
39
+ const {
40
+ id,
41
+ name,
42
+ size: effectiveSize,
43
+ color: effectiveColor,
44
+ highlight,
45
+ disabled: effectiveDisabled,
46
+ ariaAttrs,
47
+ emitFormBlur,
48
+ emitFormChange,
49
+ emitFormFocus,
50
+ emitFormInput
51
+ } = useFieldControl(props);
52
+ const FORMAT_KEY = {
53
+ hex: "HEX",
54
+ rgb: "RGB",
55
+ hsl: "HSL",
56
+ cmyk: "CMYK",
57
+ lab: "CIELab"
58
+ };
59
+ function convertColor(value, fmt) {
60
+ if (!value) return value;
61
+ try {
62
+ const key = FORMAT_KEY[fmt];
63
+ if (!key) return value;
64
+ return new ColorTranslator(value)[key];
65
+ } catch {
66
+ return value;
67
+ }
68
+ }
69
+ const openState = ref(false);
70
+ const currentFormat = ref(props.formats?.[0] ?? props.format ?? "hex");
71
+ const inputDraft = ref(modelValue.value ?? "");
72
+ watch(modelValue, (val) => {
73
+ inputDraft.value = val ?? "";
74
+ });
75
+ watch(() => props.format, (val) => {
76
+ if (val) currentFormat.value = val;
13
77
  });
14
- const chipStyle = computed(() => ({
15
- backgroundColor: modelValue.value || ""
78
+ const showFormatTabs = computed(() => (props.formats?.length ?? 0) >= 2);
79
+ const formatItems = computed(
80
+ () => (props.formats ?? []).map((f) => ({ label: f.toUpperCase(), value: f }))
81
+ );
82
+ const swatchRows = computed(() => {
83
+ const sw = props.swatches;
84
+ if (!sw || sw.length === 0) return [];
85
+ return Array.isArray(sw[0]) ? sw : [sw];
86
+ });
87
+ const hasSwatches = computed(() => swatchRows.value.length > 0);
88
+ const { baseUi, extraUi } = useExtendedTv(
89
+ popoverTheme,
90
+ theme,
91
+ () => appConfig.movk?.colorChooser,
92
+ () => ({
93
+ ui: props.ui,
94
+ variants: {
95
+ size: effectiveSize.value,
96
+ trigger: props.trigger,
97
+ disabled: effectiveDisabled.value
98
+ }
99
+ })
100
+ );
101
+ const triggerButtonAttrs = computed(() => ({
102
+ color: effectiveColor.value,
103
+ variant: props.variant,
104
+ size: effectiveSize.value,
105
+ disabled: effectiveDisabled.value,
106
+ square: props.trigger === "chip"
107
+ }));
108
+ const triggerLabel = computed(() => props.label ?? modelValue.value ?? props.placeholder);
109
+ const colorPickerAttrs = computed(() => ({
110
+ ...props.colorPickerProps ?? {},
111
+ format: currentFormat.value,
112
+ disabled: effectiveDisabled.value
16
113
  }));
114
+ const { copy, isSupported: clipboardSupported } = useClipboard();
115
+ function selectFormat(fmt) {
116
+ if (fmt === currentFormat.value) return;
117
+ currentFormat.value = fmt;
118
+ const converted = convertColor(modelValue.value, fmt);
119
+ if (converted !== modelValue.value) {
120
+ commitValue(converted);
121
+ }
122
+ emits("format-change", fmt);
123
+ }
124
+ function selectSwatch(c) {
125
+ commitValue(c);
126
+ if (props.closeOnSwatch) openState.value = false;
127
+ }
128
+ function handleCopy() {
129
+ const v = modelValue.value;
130
+ if (!v) return;
131
+ if (clipboardSupported.value) copy(v);
132
+ emits("copy", v);
133
+ }
134
+ function handleClear() {
135
+ commitValue(void 0);
136
+ emits("clear");
137
+ }
138
+ function handlePickerUpdate(v) {
139
+ commitValue(v);
140
+ }
141
+ function handleInputBlur() {
142
+ emitFormBlur();
143
+ const v = inputDraft.value.trim();
144
+ if (!v) {
145
+ commitValue(void 0);
146
+ return;
147
+ }
148
+ const normalized = convertColor(v, currentFormat.value);
149
+ const hexInvalid = currentFormat.value === "hex" && !/^#?(?:[0-9a-f]{3}|[0-9a-f]{6}|[0-9a-f]{8})$/i.test(v);
150
+ if (!normalized || normalized === v && hexInvalid) {
151
+ inputDraft.value = modelValue.value ?? "";
152
+ return;
153
+ }
154
+ commitValue(normalized);
155
+ }
156
+ function handleOpenUpdate(val) {
157
+ if (val && effectiveDisabled.value) return;
158
+ openState.value = val;
159
+ emits("update:open", val);
160
+ }
161
+ function toggleOpen() {
162
+ if (effectiveDisabled.value) return;
163
+ handleOpenUpdate(!openState.value);
164
+ }
165
+ function handleInputFocus() {
166
+ emitFormFocus();
167
+ if (effectiveDisabled.value) return;
168
+ if (!openState.value) handleOpenUpdate(true);
169
+ }
170
+ function commitValue(value) {
171
+ modelValue.value = value;
172
+ emits("change", value);
173
+ emitFormInput();
174
+ emitFormChange();
175
+ }
17
176
  </script>
18
177
 
19
178
  <template>
20
- <UPopover v-bind="props.popoverProps" @close:prevent="emit('close:prevent')" @update:open="emit('update:open', $event)">
21
- <template #default="defaultSlotProps">
22
- <slot v-bind="defaultSlotProps">
179
+ <UPopover v-bind="attrs" :open="openState" :ui="baseUi" @update:open="handleOpenUpdate">
180
+ <template v-if="props.trigger !== 'input'" #default="{ open }">
181
+ <slot :open="open" :value="modelValue">
182
+ <UButton
183
+ v-if="props.trigger === 'chip'"
184
+ :id="id"
185
+ :name="name"
186
+ v-bind="{ ...triggerButtonAttrs, ...ariaAttrs }"
187
+ :aria-label="modelValue || props.placeholder"
188
+ @blur="emitFormBlur"
189
+ @focus="emitFormFocus"
190
+ >
191
+ <span :class="extraUi.triggerChip" :style="{ backgroundColor: modelValue || 'transparent' }">
192
+ <UIcon v-if="!modelValue" :name="props.icon" :class="extraUi.triggerIcon" />
193
+ </span>
194
+ </UButton>
195
+
23
196
  <UButton
24
- color="neutral"
25
- variant="subtle"
26
- class="w-full"
27
- v-bind="props.buttonProps"
28
- :label="label"
197
+ v-else
198
+ :id="id"
199
+ :name="name"
200
+ v-bind="{ ...triggerButtonAttrs, ...ariaAttrs }"
201
+ @blur="emitFormBlur"
202
+ @focus="emitFormFocus"
29
203
  >
30
- <template #leading="leading">
31
- <slot name="leading" v-bind="leading">
32
- <span v-if="modelValue" :style="chipStyle" class="size-3 rounded-full" />
33
- <UIcon v-else name="i-lucide-palette" class="size-3" />
204
+ <template #leading>
205
+ <slot name="leading" :value="modelValue">
206
+ <span v-if="modelValue" :class="extraUi.triggerChip" :style="{ backgroundColor: modelValue }" />
207
+ <UIcon v-else :name="props.icon" />
34
208
  </slot>
35
209
  </template>
36
- <template v-if="$slots.trailing" #trailing="trailing">
37
- <slot name="trailing" v-bind="trailing" />
210
+ <span :class="extraUi.triggerLabel">{{ triggerLabel }}</span>
211
+ <template v-if="!!slots.trailing" #trailing>
212
+ <slot name="trailing" :value="modelValue" />
38
213
  </template>
39
214
  </UButton>
40
215
  </slot>
41
216
  </template>
42
217
 
43
- <template v-if="$slots.anchor" #anchor="anchor">
44
- <slot name="anchor" v-bind="anchor" />
218
+ <template v-if="props.trigger === 'input'" #anchor>
219
+ <UInput
220
+ :id="id"
221
+ v-model="inputDraft"
222
+ :name="name"
223
+ :size="effectiveSize"
224
+ :color="effectiveColor"
225
+ :highlight="highlight"
226
+ :placeholder="props.placeholder"
227
+ :disabled="effectiveDisabled"
228
+ v-bind="ariaAttrs"
229
+ @blur="handleInputBlur"
230
+ @focus="handleInputFocus"
231
+ @keydown.enter="$event.target.blur()"
232
+ >
233
+ <template #leading>
234
+ <slot name="leading" :value="modelValue">
235
+ <button
236
+ type="button"
237
+ :disabled="effectiveDisabled"
238
+ :aria-label="modelValue || props.placeholder"
239
+ class="inline-flex items-center justify-center cursor-pointer focus:outline-none disabled:cursor-not-allowed"
240
+ @mousedown.prevent
241
+ @click="toggleOpen"
242
+ >
243
+ <span
244
+ v-if="modelValue"
245
+ :class="extraUi.triggerChip"
246
+ :style="{ backgroundColor: modelValue }"
247
+ />
248
+ <UIcon
249
+ v-else
250
+ :name="props.icon"
251
+ :class="extraUi.triggerIcon"
252
+ />
253
+ </button>
254
+ </slot>
255
+ </template>
256
+ <template v-if="!!slots.trailing" #trailing>
257
+ <slot name="trailing" :value="modelValue" />
258
+ </template>
259
+ </UInput>
45
260
  </template>
46
261
 
47
262
  <template #content>
48
- <UColorPicker v-model="modelValue" class="p-2" v-bind="$attrs" />
263
+ <div :class="extraUi.body">
264
+ <div v-if="showFormatTabs" :class="extraUi.header">
265
+ <PillGroup
266
+ :model-value="currentFormat"
267
+ :items="formatItems"
268
+ value-key="value"
269
+ size="xs"
270
+ color="neutral"
271
+ @update:model-value="(v) => selectFormat(v)"
272
+ />
273
+ </div>
274
+
275
+ <UColorPicker
276
+ :model-value="modelValue ?? '#000000'"
277
+ v-bind="colorPickerAttrs"
278
+ @update:model-value="handlePickerUpdate"
279
+ />
280
+
281
+ <div v-if="hasSwatches || !!slots.swatches" :class="extraUi.section">
282
+ <slot name="swatches" :swatches="swatchRows" :select="selectSwatch">
283
+ <div v-for="(row, idx) in swatchRows" :key="idx" :class="extraUi.swatches">
284
+ <button
285
+ v-for="c in row"
286
+ :key="c"
287
+ type="button"
288
+ :aria-selected="modelValue === c"
289
+ :aria-label="c"
290
+ :class="extraUi.swatch"
291
+ :style="{ backgroundColor: c }"
292
+ @click="selectSwatch(c)"
293
+ />
294
+ </div>
295
+ </slot>
296
+ </div>
297
+
298
+ <div v-if="props.copyable || props.clearable || !!slots.actions" :class="extraUi.actions">
299
+ <slot name="actions" :value="modelValue" :copy="handleCopy" :clear="handleClear">
300
+ <span :class="extraUi.actionsValue">
301
+ {{ modelValue || "\u2014" }}
302
+ </span>
303
+ <div :class="extraUi.actionsButtons">
304
+ <UButton
305
+ v-if="props.copyable"
306
+ icon="i-lucide-copy"
307
+ size="xs"
308
+ color="neutral"
309
+ variant="ghost"
310
+ :disabled="!modelValue"
311
+ @click="handleCopy"
312
+ />
313
+ <UButton
314
+ v-if="props.clearable"
315
+ icon="i-lucide-x"
316
+ size="xs"
317
+ color="neutral"
318
+ variant="ghost"
319
+ :disabled="!modelValue"
320
+ @click="handleClear"
321
+ />
322
+ </div>
323
+ </slot>
324
+ </div>
325
+ </div>
49
326
  </template>
50
327
  </UPopover>
51
328
  </template>
@@ -1,30 +1,29 @@
1
- import type { ButtonProps, ColorPickerProps, PopoverProps } from '@nuxt/ui';
2
- export interface ColorChooserProps<P extends 'click' | 'hover' = 'click'> extends /** @vue-ignore */ ColorPickerProps {
3
- /** 弹出层组件属性 */
4
- popoverProps?: PopoverProps<P>;
5
- /** 按钮组件属性 */
6
- buttonProps?: ButtonProps;
7
- }
8
- declare const __VLS_export: <P extends "click" | "hover" = "click">(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_exposed?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
9
- props: import("vue").PublicProps & __VLS_PrettifyLocal<(ColorChooserProps<P> & {
1
+ import type { ComponentConfig } from '@nuxt/ui';
2
+ import type { AppConfig } from 'nuxt/schema';
3
+ import theme from '#build/movk-ui/color-chooser';
4
+ import popoverTheme from '#build/ui/popover';
5
+ import type { ColorChooserProps, ColorChooserSlots, ColorFormat } from '../types/components/color-chooser';
6
+ declare const __VLS_export: <M extends "click" | "hover">(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_exposed?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
7
+ props: import("vue").PublicProps & __VLS_PrettifyLocal<(ColorChooserProps<M> & {
8
+ size?: ComponentConfig<typeof popoverTheme & typeof theme, AppConfig, "colorChooser">["variants"]["size"];
9
+ trigger?: ComponentConfig<typeof popoverTheme & typeof theme, AppConfig, "colorChooser">["variants"]["trigger"];
10
+ ui?: ComponentConfig<typeof popoverTheme & typeof theme, AppConfig, "colorChooser">["slots"];
11
+ } & {
10
12
  modelValue?: string;
11
13
  }) & {
12
- [x: `on${Capitalize<string>}`]: ((...args: any) => any) | undefined;
14
+ onClear?: (() => any) | undefined;
15
+ onChange?: ((value: string | undefined) => any) | undefined;
16
+ onCopy?: ((value: string) => any) | undefined;
17
+ "onUpdate:open"?: ((open: boolean) => any) | undefined;
18
+ "onUpdate:modelValue"?: ((value: string | undefined) => any) | undefined;
19
+ "onFormat-change"?: ((format: ColorFormat) => any) | undefined;
13
20
  }> & (typeof globalThis extends {
14
- __VLS_PROPS_FALLBACK: infer P_1;
15
- } ? P_1 : {});
21
+ __VLS_PROPS_FALLBACK: infer P;
22
+ } ? P : {});
16
23
  expose: (exposed: {}) => void;
17
24
  attrs: any;
18
- slots: {
19
- default?: (props: any) => any;
20
- } & {
21
- leading?: (props: any) => any;
22
- } & {
23
- trailing?: (props: any) => any;
24
- } & {
25
- anchor?: (props: any) => any;
26
- };
27
- emit: any & ((event: "update:modelValue", value: string | undefined) => void);
25
+ slots: ColorChooserSlots;
26
+ emit: (((evt: "clear") => void) & ((evt: "change", value: string | undefined) => void) & ((evt: "copy", value: string) => void) & ((evt: "update:open", open: boolean) => void) & ((evt: "update:modelValue", value: string | undefined) => void) & ((evt: "format-change", format: ColorFormat) => void)) & ((event: "update:modelValue", value: string | undefined) => void);
28
27
  }>) => import("vue").VNode & {
29
28
  __ctx?: Awaited<typeof __VLS_setup>;
30
29
  };
@@ -0,0 +1,57 @@
1
+ import type { ColumnPinningState, ColumnSizingState, ExpandedState, PaginationState, RowPinningState, RowSelectionState, SortingState, VisibilityState } from '@tanstack/vue-table';
2
+ import type { TableData } from '@nuxt/ui';
3
+ import type { DataTableExposed, DataTableProps, DataTableSlots } from '../types/data-table/component';
4
+ import type { DataTablePaginationUi } from '../types/data-table/pagination';
5
+ declare const __VLS_export: <T extends TableData>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_exposed?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
6
+ props: import("vue").PublicProps & __VLS_PrettifyLocal<(DataTableProps<T> & {
7
+ ui?: {
8
+ [x: string]: import("tailwind-variants").ClassValue;
9
+ };
10
+ paginationUi?: DataTablePaginationUi & {
11
+ ui?: {
12
+ [x: string]: import("tailwind-variants").ClassValue;
13
+ };
14
+ };
15
+ } & {
16
+ pagination?: PaginationState;
17
+ columnVisibility?: VisibilityState;
18
+ columnPinning?: ColumnPinningState;
19
+ columnSizing?: ColumnSizingState;
20
+ rowSelection?: RowSelectionState;
21
+ rowPinning?: RowPinningState;
22
+ sorting?: SortingState;
23
+ expanded?: ExpandedState;
24
+ columnVisibilityKeys?: string[];
25
+ columnVisibilityExcludeKeys?: string[];
26
+ rowSelectionKeys?: string[];
27
+ expandedKeys?: string[];
28
+ }) & {
29
+ "onUpdate:pagination"?: ((value: PaginationState | undefined) => any) | undefined;
30
+ "onUpdate:columnVisibility"?: ((value: VisibilityState | undefined) => any) | undefined;
31
+ "onUpdate:columnPinning"?: ((value: ColumnPinningState | undefined) => any) | undefined;
32
+ "onUpdate:columnSizing"?: ((value: ColumnSizingState | undefined) => any) | undefined;
33
+ "onUpdate:rowSelection"?: ((value: RowSelectionState | undefined) => any) | undefined;
34
+ "onUpdate:rowPinning"?: ((value: RowPinningState) => any) | undefined;
35
+ "onUpdate:sorting"?: ((value: SortingState) => any) | undefined;
36
+ "onUpdate:expanded"?: ((value: ExpandedState | undefined) => any) | undefined;
37
+ "onUpdate:columnVisibilityKeys"?: ((value: string[] | undefined) => any) | undefined;
38
+ "onUpdate:columnVisibilityExcludeKeys"?: ((value: string[] | undefined) => any) | undefined;
39
+ "onUpdate:rowSelectionKeys"?: ((value: string[] | undefined) => any) | undefined;
40
+ "onUpdate:expandedKeys"?: ((value: string[] | undefined) => any) | undefined;
41
+ }> & (typeof globalThis extends {
42
+ __VLS_PROPS_FALLBACK: infer P;
43
+ } ? P : {});
44
+ expose: (exposed: import("vue").ShallowUnwrapRef<DataTableExposed<T>>) => void;
45
+ attrs: any;
46
+ slots: DataTableSlots<T>;
47
+ emit: ((event: "update:pagination", value: PaginationState | undefined) => void) & ((event: "update:columnVisibility", value: VisibilityState | undefined) => void) & ((event: "update:columnPinning", value: ColumnPinningState | undefined) => void) & ((event: "update:columnSizing", value: ColumnSizingState | undefined) => void) & ((event: "update:rowSelection", value: RowSelectionState | undefined) => void) & ((event: "update:rowPinning", value: RowPinningState) => void) & ((event: "update:sorting", value: SortingState) => void) & ((event: "update:expanded", value: ExpandedState | undefined) => void) & ((event: "update:columnVisibilityKeys", value: string[] | undefined) => void) & ((event: "update:columnVisibilityExcludeKeys", value: string[] | undefined) => void) & ((event: "update:rowSelectionKeys", value: string[] | undefined) => void) & ((event: "update:expandedKeys", value: string[] | undefined) => void);
48
+ }>) => import("vue").VNode & {
49
+ __ctx?: Awaited<typeof __VLS_setup>;
50
+ };
51
+ declare const _default: typeof __VLS_export;
52
+ export default _default;
53
+ type __VLS_PrettifyLocal<T> = (T extends any ? {
54
+ [K in keyof T]: T[K];
55
+ } : {
56
+ [K in keyof T as K]: T[K];
57
+ }) & {};