@donotdev/crud 0.2.2 → 0.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 (373) hide show
  1. package/dist/CrudService.bulk.d.ts +17 -16
  2. package/dist/CrudService.bulk.d.ts.map +1 -1
  3. package/dist/CrudService.bulk.js +1 -1
  4. package/dist/CrudService.bulkAcross.d.ts +15 -8
  5. package/dist/CrudService.bulkAcross.d.ts.map +1 -1
  6. package/dist/CrudService.bulkAcross.js +1 -1
  7. package/dist/CrudService.bulkReconciliation.d.ts +4 -0
  8. package/dist/CrudService.bulkReconciliation.d.ts.map +1 -0
  9. package/dist/CrudService.bulkReconciliation.js +1 -0
  10. package/dist/CrudService.cache.d.ts +22 -3
  11. package/dist/CrudService.cache.d.ts.map +1 -1
  12. package/dist/CrudService.cache.js +1 -1
  13. package/dist/CrudService.d.ts +42 -11
  14. package/dist/CrudService.d.ts.map +1 -1
  15. package/dist/CrudService.internal.d.ts +3 -2
  16. package/dist/CrudService.internal.d.ts.map +1 -1
  17. package/dist/CrudService.internal.js +2 -2
  18. package/dist/CrudService.js +1 -1
  19. package/dist/CrudService.mutations.d.ts +3 -3
  20. package/dist/CrudService.mutations.d.ts.map +1 -1
  21. package/dist/CrudService.mutations.js +1 -1
  22. package/dist/CrudService.optimistic.d.ts +2 -2
  23. package/dist/CrudService.optimistic.d.ts.map +1 -1
  24. package/dist/CrudService.optimistic.js +1 -1
  25. package/dist/CrudService.queries.d.ts.map +1 -1
  26. package/dist/CrudService.queries.js +1 -1
  27. package/dist/CrudService.subscriptions.d.ts.map +1 -1
  28. package/dist/CrudService.subscriptions.js +1 -1
  29. package/dist/CrudService.writeRules.d.ts +57 -0
  30. package/dist/CrudService.writeRules.d.ts.map +1 -0
  31. package/dist/CrudService.writeRules.js +1 -0
  32. package/dist/CrudService.writeSchema.d.ts +64 -0
  33. package/dist/CrudService.writeSchema.d.ts.map +1 -0
  34. package/dist/CrudService.writeSchema.js +1 -0
  35. package/dist/CrudStore.d.ts +10 -1
  36. package/dist/CrudStore.d.ts.map +1 -1
  37. package/dist/CrudStore.js +1 -1
  38. package/dist/FieldRegistry.d.ts +1 -1
  39. package/dist/FieldRegistry.d.ts.map +1 -1
  40. package/dist/adapters/FunctionsAdapter.d.ts +3 -3
  41. package/dist/adapters/FunctionsAdapter.d.ts.map +1 -1
  42. package/dist/adapters/FunctionsAdapter.js +1 -1
  43. package/dist/components/CrudButton.d.ts +3 -2
  44. package/dist/components/CrudButton.d.ts.map +1 -1
  45. package/dist/components/CrudButton.js +1 -1
  46. package/dist/components/CrudCard.d.ts +2 -2
  47. package/dist/components/CrudCard.d.ts.map +1 -1
  48. package/dist/components/CrudCard.js +1 -1
  49. package/dist/components/DateFilter.js +1 -1
  50. package/dist/components/DisplayFieldRenderer.d.ts +5 -2
  51. package/dist/components/DisplayFieldRenderer.d.ts.map +1 -1
  52. package/dist/components/DisplayFieldRenderer.js +1 -1
  53. package/dist/components/DisplayThumbnail.d.ts.map +1 -1
  54. package/dist/components/DisplayThumbnail.js +1 -1
  55. package/dist/components/EntityFilters.d.ts +26 -4
  56. package/dist/components/EntityFilters.d.ts.map +1 -1
  57. package/dist/components/EntityFilters.js +1 -1
  58. package/dist/components/FormFieldRenderer.d.ts +21 -12
  59. package/dist/components/FormFieldRenderer.d.ts.map +1 -1
  60. package/dist/components/FormFieldRenderer.js +1 -1
  61. package/dist/components/FormLayout.d.ts.map +1 -1
  62. package/dist/components/FormLayout.js +1 -1
  63. package/dist/components/SortableCardList.d.ts +47 -0
  64. package/dist/components/SortableCardList.d.ts.map +1 -0
  65. package/dist/components/SortableCardList.js +1 -0
  66. package/dist/components/YearFilter.js +1 -1
  67. package/dist/components/controlled/complex/ControlledAddressField.d.ts.map +1 -1
  68. package/dist/components/controlled/complex/ControlledAddressField.js +1 -1
  69. package/dist/components/controlled/complex/ControlledDateField.d.ts.map +1 -1
  70. package/dist/components/controlled/complex/ControlledDateField.js +1 -1
  71. package/dist/components/controlled/complex/ControlledFieldArrayField.d.ts +9 -0
  72. package/dist/components/controlled/complex/ControlledFieldArrayField.d.ts.map +1 -1
  73. package/dist/components/controlled/complex/ControlledFieldArrayField.js +1 -1
  74. package/dist/components/controlled/complex/ControlledGeoPointField.d.ts.map +1 -1
  75. package/dist/components/controlled/complex/ControlledMapField.d.ts.map +1 -1
  76. package/dist/components/controlled/complex/ControlledMultiInputField.d.ts.map +1 -1
  77. package/dist/components/controlled/complex/ControlledMultiInputField.js +1 -1
  78. package/dist/components/controlled/complex/ControlledRichTextField.d.ts.map +1 -1
  79. package/dist/components/controlled/complex/ControlledTimestampField.d.ts.map +1 -1
  80. package/dist/components/controlled/complex/ControlledTimestampField.js +1 -1
  81. package/dist/components/controlled/fieldOptions.d.ts +48 -0
  82. package/dist/components/controlled/fieldOptions.d.ts.map +1 -0
  83. package/dist/components/controlled/fieldOptions.js +1 -0
  84. package/dist/components/controlled/file/ControlledDocumentField.js +1 -1
  85. package/dist/components/controlled/file/ControlledFileField.js +1 -1
  86. package/dist/components/controlled/file/ControlledImageField.d.ts.map +1 -1
  87. package/dist/components/controlled/file/ControlledImageField.js +1 -1
  88. package/dist/components/controlled/file/ControlledMultiDocumentField.d.ts.map +1 -1
  89. package/dist/components/controlled/file/ControlledMultiDocumentField.js +1 -1
  90. package/dist/components/controlled/file/ControlledMultiFileField.d.ts.map +1 -1
  91. package/dist/components/controlled/file/ControlledMultiFileField.js +1 -1
  92. package/dist/components/controlled/file/ControlledMultiImageField.d.ts.map +1 -1
  93. package/dist/components/controlled/file/ControlledMultiImageField.js +1 -1
  94. package/dist/components/controlled/input/ControlledCheckboxField.d.ts.map +1 -1
  95. package/dist/components/controlled/input/ControlledCurrencyField.d.ts.map +1 -1
  96. package/dist/components/controlled/input/ControlledCurrencyField.js +1 -1
  97. package/dist/components/controlled/input/ControlledDurationField.d.ts.map +1 -1
  98. package/dist/components/controlled/input/ControlledDurationField.js +1 -1
  99. package/dist/components/controlled/input/ControlledGdprConsentField.d.ts.map +1 -1
  100. package/dist/components/controlled/input/ControlledGdprConsentField.js +1 -1
  101. package/dist/components/controlled/input/ControlledNumberField.d.ts.map +1 -1
  102. package/dist/components/controlled/input/ControlledNumberField.js +1 -1
  103. package/dist/components/controlled/input/ControlledPasswordField.d.ts.map +1 -1
  104. package/dist/components/controlled/input/ControlledPasswordField.js +1 -1
  105. package/dist/components/controlled/input/ControlledPhoneField.d.ts.map +1 -1
  106. package/dist/components/controlled/input/ControlledPhoneField.js +1 -1
  107. package/dist/components/controlled/input/ControlledPriceField.d.ts.map +1 -1
  108. package/dist/components/controlled/input/ControlledPriceField.js +1 -1
  109. package/dist/components/controlled/input/ControlledRangeField.d.ts.map +1 -1
  110. package/dist/components/controlled/input/ControlledRangeField.js +1 -1
  111. package/dist/components/controlled/input/ControlledRatingField.d.ts.map +1 -1
  112. package/dist/components/controlled/input/ControlledRatingField.js +1 -1
  113. package/dist/components/controlled/input/ControlledSwitchField.d.ts.map +1 -1
  114. package/dist/components/controlled/input/ControlledSwitchField.js +1 -1
  115. package/dist/components/controlled/input/ControlledTextField.d.ts.map +1 -1
  116. package/dist/components/controlled/input/ControlledTextField.js +1 -1
  117. package/dist/components/controlled/input/ControlledTextareaField.d.ts.map +1 -1
  118. package/dist/components/controlled/input/ControlledTextareaField.js +1 -1
  119. package/dist/components/controlled/select/ControlledComboboxField.d.ts.map +1 -1
  120. package/dist/components/controlled/select/ControlledComboboxField.js +1 -1
  121. package/dist/components/controlled/select/ControlledDropdownField.d.ts.map +1 -1
  122. package/dist/components/controlled/select/ControlledDropdownField.js +1 -1
  123. package/dist/components/controlled/select/ControlledMultiDropdownField.d.ts.map +1 -1
  124. package/dist/components/controlled/select/ControlledMultiDropdownField.js +1 -1
  125. package/dist/components/controlled/select/ControlledRadioField.d.ts.map +1 -1
  126. package/dist/components/controlled/select/ControlledReferenceField.d.ts.map +1 -1
  127. package/dist/components/controlled/select/ControlledReferenceField.js +1 -1
  128. package/dist/components/controlled/select/ControlledYearField.d.ts.map +1 -1
  129. package/dist/components/controlled/select/ControlledYearField.js +1 -1
  130. package/dist/components/controlled/types.d.ts.map +1 -1
  131. package/dist/components/fields/display/AvatarFieldDisplay.d.ts.map +1 -1
  132. package/dist/components/fields/display/AvatarFieldDisplay.js +1 -1
  133. package/dist/components/fields/display/BadgeFieldDisplay.d.ts.map +1 -1
  134. package/dist/components/fields/display/ButtonFieldDisplay.d.ts.map +1 -1
  135. package/dist/components/fields/display/CheckboxFieldDisplay.d.ts.map +1 -1
  136. package/dist/components/fields/display/CheckboxFieldDisplay.js +1 -1
  137. package/dist/components/fields/display/DateFieldDisplay.d.ts.map +1 -1
  138. package/dist/components/fields/display/DateFieldDisplay.js +1 -1
  139. package/dist/components/fields/display/DropdownDisplay.d.ts.map +1 -1
  140. package/dist/components/fields/display/FileFieldDisplay.d.ts.map +1 -1
  141. package/dist/components/fields/display/FileFieldDisplay.js +1 -1
  142. package/dist/components/fields/display/GeoPointFieldDisplay.d.ts.map +1 -1
  143. package/dist/components/fields/display/HiddenFieldDisplay.d.ts.map +1 -1
  144. package/dist/components/fields/display/ImageFieldDisplay.d.ts.map +1 -1
  145. package/dist/components/fields/display/LinkFieldDisplay.d.ts.map +1 -1
  146. package/dist/components/fields/display/LinkFieldDisplay.js +1 -1
  147. package/dist/components/fields/display/MapFieldDisplay.d.ts.map +1 -1
  148. package/dist/components/fields/display/MultiDropdownDisplay.d.ts.map +1 -1
  149. package/dist/components/fields/display/MultiInputTextFieldDisplay.d.ts.map +1 -1
  150. package/dist/components/fields/display/NumberFieldDisplay.d.ts.map +1 -1
  151. package/dist/components/fields/display/NumberFieldDisplay.js +1 -1
  152. package/dist/components/fields/display/PasswordFieldDisplay.d.ts.map +1 -1
  153. package/dist/components/fields/display/PasswordFieldDisplay.js +1 -1
  154. package/dist/components/fields/display/PhoneNumberDisplay.d.ts.map +1 -1
  155. package/dist/components/fields/display/RadioFieldDisplay.d.ts.map +1 -1
  156. package/dist/components/fields/display/RangeFieldDisplay.d.ts.map +1 -1
  157. package/dist/components/fields/display/ReferenceFieldDisplay.d.ts.map +1 -1
  158. package/dist/components/fields/display/ReferenceFieldDisplay.js +1 -1
  159. package/dist/components/fields/display/RichTextDisplay.d.ts.map +1 -1
  160. package/dist/components/fields/display/TextAreaDisplay.d.ts.map +1 -1
  161. package/dist/components/fields/display/TextAreaDisplay.js +1 -1
  162. package/dist/components/fields/display/TextFieldDisplay.d.ts.map +1 -1
  163. package/dist/components/fields/display/TextFieldDisplay.js +1 -1
  164. package/dist/components/fields/display/TimestampFieldDisplay.d.ts.map +1 -1
  165. package/dist/components/form/fields/AddressFieldComponent.d.ts +3 -1
  166. package/dist/components/form/fields/AddressFieldComponent.d.ts.map +1 -1
  167. package/dist/components/form/fields/AddressFieldComponent.js +1 -1
  168. package/dist/components/form/fields/AvatarFieldComponent.d.ts.map +1 -1
  169. package/dist/components/form/fields/AvatarFieldComponent.js +1 -1
  170. package/dist/components/form/fields/BadgeFieldComponent.d.ts.map +1 -1
  171. package/dist/components/form/fields/BadgeFieldComponent.js +1 -1
  172. package/dist/components/form/fields/ButtonFieldComponent.js +1 -1
  173. package/dist/components/form/fields/CheckboxFieldComponent.d.ts.map +1 -1
  174. package/dist/components/form/fields/CheckboxFieldComponent.js +1 -1
  175. package/dist/components/form/fields/ComboboxComponent.d.ts +2 -0
  176. package/dist/components/form/fields/ComboboxComponent.d.ts.map +1 -1
  177. package/dist/components/form/fields/ComboboxComponent.js +1 -1
  178. package/dist/components/form/fields/CurrencyFieldComponent.d.ts +2 -0
  179. package/dist/components/form/fields/CurrencyFieldComponent.d.ts.map +1 -1
  180. package/dist/components/form/fields/CurrencyFieldComponent.js +1 -1
  181. package/dist/components/form/fields/DateFieldComponent.d.ts +2 -0
  182. package/dist/components/form/fields/DateFieldComponent.d.ts.map +1 -1
  183. package/dist/components/form/fields/DateFieldComponent.js +1 -1
  184. package/dist/components/form/fields/DocumentFieldComponent.js +1 -1
  185. package/dist/components/form/fields/DropdownComponent.d.ts +2 -0
  186. package/dist/components/form/fields/DropdownComponent.d.ts.map +1 -1
  187. package/dist/components/form/fields/DropdownComponent.js +1 -1
  188. package/dist/components/form/fields/DurationFieldComponent.d.ts.map +1 -1
  189. package/dist/components/form/fields/DurationFieldComponent.js +1 -1
  190. package/dist/components/form/fields/FileFieldComponent.js +1 -1
  191. package/dist/components/form/fields/GdprConsentFieldComponent.d.ts.map +1 -1
  192. package/dist/components/form/fields/GdprConsentFieldComponent.js +1 -1
  193. package/dist/components/form/fields/GeoPointFieldComponent.js +1 -1
  194. package/dist/components/form/fields/ImageFieldComponent.d.ts.map +1 -1
  195. package/dist/components/form/fields/ImageFieldComponent.js +1 -1
  196. package/dist/components/form/fields/MapFieldComponent.d.ts.map +1 -1
  197. package/dist/components/form/fields/MultiDropdownComponent.d.ts +2 -0
  198. package/dist/components/form/fields/MultiDropdownComponent.d.ts.map +1 -1
  199. package/dist/components/form/fields/MultiDropdownComponent.js +1 -1
  200. package/dist/components/form/fields/MultiInputTextFieldComponent.d.ts +2 -0
  201. package/dist/components/form/fields/MultiInputTextFieldComponent.d.ts.map +1 -1
  202. package/dist/components/form/fields/MultiInputTextFieldComponent.js +1 -1
  203. package/dist/components/form/fields/NumberFieldComponent.d.ts +2 -0
  204. package/dist/components/form/fields/NumberFieldComponent.d.ts.map +1 -1
  205. package/dist/components/form/fields/NumberFieldComponent.js +1 -1
  206. package/dist/components/form/fields/PasswordFieldComponent.d.ts +2 -0
  207. package/dist/components/form/fields/PasswordFieldComponent.d.ts.map +1 -1
  208. package/dist/components/form/fields/PasswordFieldComponent.js +1 -1
  209. package/dist/components/form/fields/PhoneNumberComponent.d.ts +11 -1
  210. package/dist/components/form/fields/PhoneNumberComponent.d.ts.map +1 -1
  211. package/dist/components/form/fields/PhoneNumberComponent.js +1 -1
  212. package/dist/components/form/fields/PriceFieldComponent.d.ts +2 -0
  213. package/dist/components/form/fields/PriceFieldComponent.d.ts.map +1 -1
  214. package/dist/components/form/fields/PriceFieldComponent.js +1 -1
  215. package/dist/components/form/fields/RangeFieldComponent.js +1 -1
  216. package/dist/components/form/fields/RatingFieldComponent.js +1 -1
  217. package/dist/components/form/fields/ReferenceFieldComponent.d.ts +3 -1
  218. package/dist/components/form/fields/ReferenceFieldComponent.d.ts.map +1 -1
  219. package/dist/components/form/fields/ReferenceFieldComponent.js +1 -1
  220. package/dist/components/form/fields/RichTextComponent.js +1 -1
  221. package/dist/components/form/fields/SwitchFieldComponent.d.ts.map +1 -1
  222. package/dist/components/form/fields/SwitchFieldComponent.js +1 -1
  223. package/dist/components/form/fields/TextAreaComponent.d.ts +2 -0
  224. package/dist/components/form/fields/TextAreaComponent.d.ts.map +1 -1
  225. package/dist/components/form/fields/TextAreaComponent.js +1 -1
  226. package/dist/components/form/fields/TextFieldComponent.d.ts +3 -1
  227. package/dist/components/form/fields/TextFieldComponent.d.ts.map +1 -1
  228. package/dist/components/form/fields/TextFieldComponent.js +1 -1
  229. package/dist/components/form/fields/TimestampFieldComponent.d.ts +2 -0
  230. package/dist/components/form/fields/TimestampFieldComponent.d.ts.map +1 -1
  231. package/dist/components/form/fields/TimestampFieldComponent.js +1 -1
  232. package/dist/components/form/fields/internal/InlineFieldRow.d.ts +24 -0
  233. package/dist/components/form/fields/internal/InlineFieldRow.d.ts.map +1 -0
  234. package/dist/components/form/fields/internal/InlineFieldRow.js +1 -0
  235. package/dist/components/form/fields/internal/TiptapEditor.d.ts.map +1 -1
  236. package/dist/components/form/fields/internal/TiptapEditor.js +2 -2
  237. package/dist/components/form/internal/ImageViewerDialog.js +1 -1
  238. package/dist/components/index.d.ts +2 -0
  239. package/dist/components/index.d.ts.map +1 -1
  240. package/dist/components/index.js +1 -1
  241. package/dist/fieldTypeRegistry.d.ts +2 -2
  242. package/dist/fieldTypeRegistry.d.ts.map +1 -1
  243. package/dist/fieldTypeRegistry.js +1 -1
  244. package/dist/fieldTypeRegistry.store.d.ts +0 -2
  245. package/dist/fieldTypeRegistry.store.d.ts.map +1 -1
  246. package/dist/fieldTypeRegistry.store.js +1 -1
  247. package/dist/fieldTypeRegistry.types.d.ts +8 -9
  248. package/dist/fieldTypeRegistry.types.d.ts.map +1 -1
  249. package/dist/forms/FormNavigation.d.ts +24 -0
  250. package/dist/forms/FormNavigation.d.ts.map +1 -0
  251. package/dist/forms/FormNavigation.js +1 -0
  252. package/dist/forms/childRows.d.ts +184 -0
  253. package/dist/forms/childRows.d.ts.map +1 -0
  254. package/dist/forms/childRows.js +1 -0
  255. package/dist/forms/extend.d.ts +88 -0
  256. package/dist/forms/extend.d.ts.map +1 -0
  257. package/dist/forms/extend.js +1 -0
  258. package/dist/forms/hooks/useController.js +1 -1
  259. package/dist/forms/hooks/useEntityField.d.ts +11 -5
  260. package/dist/forms/hooks/useEntityField.d.ts.map +1 -1
  261. package/dist/forms/hooks/useEntityField.js +1 -1
  262. package/dist/forms/hooks/useEntityForm.d.ts +50 -5
  263. package/dist/forms/hooks/useEntityForm.d.ts.map +1 -1
  264. package/dist/forms/hooks/useEntityForm.js +1 -1
  265. package/dist/forms/hooks/useFormDraftState.d.ts +53 -0
  266. package/dist/forms/hooks/useFormDraftState.d.ts.map +1 -0
  267. package/dist/forms/hooks/useFormDraftState.js +1 -0
  268. package/dist/forms/index.d.ts +6 -2
  269. package/dist/forms/index.d.ts.map +1 -1
  270. package/dist/forms/index.js +1 -1
  271. package/dist/forms/types.d.ts +171 -25
  272. package/dist/forms/types.d.ts.map +1 -1
  273. package/dist/forms/utils/buildInitialValues.d.ts +32 -17
  274. package/dist/forms/utils/buildInitialValues.d.ts.map +1 -1
  275. package/dist/forms/utils/buildInitialValues.js +1 -1
  276. package/dist/forms/utils/conditionAwareResolver.d.ts +35 -0
  277. package/dist/forms/utils/conditionAwareResolver.d.ts.map +1 -0
  278. package/dist/forms/utils/conditionAwareResolver.js +1 -0
  279. package/dist/forms/utils/emptyValue.d.ts +34 -0
  280. package/dist/forms/utils/emptyValue.d.ts.map +1 -0
  281. package/dist/forms/utils/emptyValue.js +1 -0
  282. package/dist/forms/utils/getFieldsForOperation.d.ts +30 -19
  283. package/dist/forms/utils/getFieldsForOperation.d.ts.map +1 -1
  284. package/dist/forms/utils/getFieldsForOperation.js +1 -1
  285. package/dist/forms/utils/index.d.ts +1 -0
  286. package/dist/forms/utils/index.d.ts.map +1 -1
  287. package/dist/forms/utils/index.js +1 -1
  288. package/dist/forms/utils/isFieldEditable.d.ts +21 -22
  289. package/dist/forms/utils/isFieldEditable.d.ts.map +1 -1
  290. package/dist/forms/utils/isFieldEditable.js +1 -1
  291. package/dist/forms/utils/translateFieldLabel.d.ts +1 -9
  292. package/dist/forms/utils/translateFieldLabel.d.ts.map +1 -1
  293. package/dist/forms/utils/translateFieldLabel.js +1 -1
  294. package/dist/forms/utils/validateEntity.js +1 -1
  295. package/dist/forms/utils/writableFields.d.ts +19 -0
  296. package/dist/forms/utils/writableFields.d.ts.map +1 -0
  297. package/dist/forms/utils/writableFields.js +1 -0
  298. package/dist/hooks/index.d.ts +2 -0
  299. package/dist/hooks/index.d.ts.map +1 -1
  300. package/dist/hooks/index.js +1 -1
  301. package/dist/hooks/useChildRows.d.ts +161 -0
  302. package/dist/hooks/useChildRows.d.ts.map +1 -0
  303. package/dist/hooks/useChildRows.js +1 -0
  304. package/dist/hooks/useCrudFilters.d.ts +21 -1
  305. package/dist/hooks/useCrudFilters.d.ts.map +1 -1
  306. package/dist/hooks/useCrudFilters.js +1 -1
  307. package/dist/hooks/useCrudPageSize.js +1 -1
  308. package/dist/hooks/useEntityFavorites.js +1 -1
  309. package/dist/hooks/useExtensionRows.d.ts +24 -0
  310. package/dist/hooks/useExtensionRows.d.ts.map +1 -0
  311. package/dist/hooks/useExtensionRows.js +1 -0
  312. package/dist/hooks/useFieldConditions.d.ts +2 -2
  313. package/dist/hooks/useFieldConditions.d.ts.map +1 -1
  314. package/dist/hooks/useFieldConditions.js +1 -1
  315. package/dist/hooks/useFileUpload.js +1 -1
  316. package/dist/hooks/useReferenceResolver.d.ts +4 -1
  317. package/dist/hooks/useReferenceResolver.d.ts.map +1 -1
  318. package/dist/hooks/useReferenceResolver.js +1 -1
  319. package/dist/hooks/useRelatedItems.js +1 -1
  320. package/dist/index.d.ts +6 -5
  321. package/dist/index.d.ts.map +1 -1
  322. package/dist/index.js +1 -1
  323. package/dist/registerBuiltinFieldTypes.d.ts +4 -2
  324. package/dist/registerBuiltinFieldTypes.d.ts.map +1 -1
  325. package/dist/registerBuiltinFieldTypes.js +1 -1
  326. package/dist/stores/FormStore.d.ts +116 -5
  327. package/dist/stores/FormStore.d.ts.map +1 -1
  328. package/dist/stores/FormStore.js +1 -1
  329. package/dist/stores/UploadStore.js +1 -1
  330. package/dist/stores/index.d.ts +1 -1
  331. package/dist/stores/index.d.ts.map +1 -1
  332. package/dist/stores/index.js +1 -1
  333. package/dist/symbol-index.json +1 -1
  334. package/dist/tsconfig.tsbuildinfo +1 -1
  335. package/dist/types.d.ts +40 -7
  336. package/dist/types.d.ts.map +1 -1
  337. package/dist/useBaseCrudList.d.ts.map +1 -1
  338. package/dist/useBaseCrudList.js +1 -1
  339. package/dist/useCrud.d.ts +20 -9
  340. package/dist/useCrud.d.ts.map +1 -1
  341. package/dist/useCrud.js +1 -1
  342. package/dist/useCrudCardList.js +1 -1
  343. package/dist/useCrudDoc.d.ts.map +1 -1
  344. package/dist/useCrudDoc.js +1 -1
  345. package/dist/useCrudList.js +1 -1
  346. package/dist/utils/clientListProcessing.d.ts +9 -12
  347. package/dist/utils/clientListProcessing.d.ts.map +1 -1
  348. package/dist/utils/clientListProcessing.js +1 -1
  349. package/dist/utils/collections.d.ts.map +1 -1
  350. package/dist/utils/collections.js +1 -1
  351. package/dist/utils/filterUrl.d.ts +45 -0
  352. package/dist/utils/filterUrl.d.ts.map +1 -0
  353. package/dist/utils/filterUrl.js +1 -0
  354. package/dist/utils/imageProcessing.js +1 -1
  355. package/dist/utils/matchesFilter.d.ts +27 -3
  356. package/dist/utils/matchesFilter.d.ts.map +1 -1
  357. package/dist/utils/matchesFilter.js +1 -1
  358. package/dist/utils/referenceEntity.d.ts +11 -0
  359. package/dist/utils/referenceEntity.d.ts.map +1 -0
  360. package/dist/utils/referenceEntity.js +1 -0
  361. package/dist/utils/uploadValidation.js +1 -1
  362. package/dist/utils/useRowTranslator.d.ts +21 -0
  363. package/dist/utils/useRowTranslator.d.ts.map +1 -0
  364. package/dist/utils/useRowTranslator.js +1 -0
  365. package/dist/workflows/defineWorkflow.js +1 -1
  366. package/dist/workflows/useEntityWorkflow.js +1 -1
  367. package/guidelines/COMPONENTS.md +87 -10
  368. package/guidelines/CRUD.md +336 -17
  369. package/guidelines/GOTCHAS.md +19 -1
  370. package/package.json +8 -8
  371. package/dist/builtinFieldTypes.d.ts +0 -23
  372. package/dist/builtinFieldTypes.d.ts.map +0 -1
  373. package/dist/builtinFieldTypes.js +0 -1
@@ -1 +1 @@
1
- import{jsx as v,jsxs as j}from"react/jsx-runtime";import{useState as q,useEffect as z,useCallback as f}from"react";import{Input as D,cn as E,Stack as I}from"@donotdev/components";import{useTranslation as L}from"@donotdev/core";const M=({label:b,value:l,onChange:i,error:g,helperText:c,min:x,max:y,step:N,disabled:s,required:S,className:h,mask:r="number",...w})=>{const{i18n:F}=L(),n=F?.language||(typeof navigator<"u"?navigator.language:"en-US"),u=f(a=>a==null||isNaN(a)?"":r==="currency"?a.toLocaleString(n,{minimumFractionDigits:2,maximumFractionDigits:2}):r==="mileage"?Math.round(a).toLocaleString(n):a.toString(),[r,n]),T=f(a=>{if(!a||a.trim()==="")return null;const t=new Intl.NumberFormat(n).formatToParts(1234.56),e=t.find(m=>m.type==="group")?.value||",",C=t.find(m=>m.type==="decimal")?.value||".";let o=a.replace(new RegExp(`\\${e}`,"g"),"");o=o.replace(C,"."),o=o.replace(/[^\d.\-]/g,"");const p=parseFloat(o);return isNaN(p)?null:p},[n]),[k,d]=q(()=>u(l));return z(()=>{d(u(l))},[l,u]),j(I,{gap:"tight",children:[v(D,{type:r==="number"?"number":"text",inputMode:r==="number"?void 0:"decimal",label:b,value:k,onChange:a=>{const t=a.target.value;if(d(t),r==="number"){const e=parseFloat(t);isNaN(e)?i(a):i({...a,target:{...a.target,value:e.toString()}})}else{const e=T(t);e!==null?i({...a,target:{...a.target,value:e.toString()}}):t===""&&i({...a,target:{...a.target,value:""}})}},min:x,max:y,step:N,disabled:s,required:S,className:E("dndev-w-full",h),"data-variant":g?"destructive":void 0,style:{opacity:s?"var(--opacity-muted)":void 0,cursor:s?"not-allowed":void 0},...w}),c&&v("p",{style:{fontSize:"var(--font-size-xs)",color:g?"var(--destructive-foreground)":"var(--muted-foreground)",marginTop:"var(--gap-sm)"},children:c})]})};var G=M;export{G as default};
1
+ import{jsx as v,jsxs as q}from"react/jsx-runtime";import{useState as z,useEffect as D,useCallback as f}from"react";import{Input as E,cn as I,Stack as L}from"@donotdev/components";import{useTranslation as M}from"@donotdev/core";const P=({label:b,info:x,value:l,onChange:i,error:g,helperText:c,min:y,max:N,step:S,disabled:s,required:h,className:w,mask:r="number",...F})=>{const{i18n:k}=M(),n=k?.language||(typeof navigator<"u"?navigator.language:"en-US"),u=f(a=>a==null||isNaN(a)?"":r==="currency"?a.toLocaleString(n,{minimumFractionDigits:2,maximumFractionDigits:2}):r==="mileage"?Math.round(a).toLocaleString(n):a.toString(),[r,n]),C=f(a=>{if(!a||a.trim()==="")return null;const t=new Intl.NumberFormat(n).formatToParts(1234.56),e=t.find(m=>m.type==="group")?.value||",",j=t.find(m=>m.type==="decimal")?.value||".";let o=a.replace(new RegExp(`\\${e}`,"g"),"");o=o.replace(j,"."),o=o.replace(/[^\d.\-]/g,"");const p=parseFloat(o);return isNaN(p)?null:p},[n]),[T,d]=z(()=>u(l));return D(()=>{d(u(l))},[l,u]),q(L,{gap:"tight",children:[v(E,{type:r==="number"?"number":"text",inputMode:r==="number"?void 0:"decimal",label:b,info:x,value:T,onChange:a=>{const t=a.target.value;if(d(t),r==="number"){const e=parseFloat(t);isNaN(e)?i(a):i({...a,target:{...a.target,value:e.toString()}})}else{const e=C(t);e!==null?i({...a,target:{...a.target,value:e.toString()}}):t===""&&i({...a,target:{...a.target,value:""}})}},min:y,max:N,step:S,disabled:s,required:h,className:I("dndev-w-full",w),"data-variant":g?"destructive":void 0,style:{opacity:s?"var(--opacity-muted)":void 0,cursor:s?"not-allowed":void 0},...F}),c&&v("p",{style:{fontSize:"var(--font-size-xs)",color:g?"var(--destructive-foreground)":"var(--muted-foreground)",marginTop:"var(--gap-sm)"},children:c})]})};var H=P;export{H as default};
@@ -3,6 +3,8 @@ import { PasswordInput } from '@donotdev/components';
3
3
  export interface PasswordFieldComponentProps extends Omit<ComponentProps<typeof PasswordInput>, 'value' | 'onChange'> {
4
4
  /** Field label */
5
5
  label: string;
6
+ /** Help text (entity field `hint`): an (i) after the label shows it */
7
+ info?: string;
6
8
  /** Current value */
7
9
  value?: string;
8
10
  /** Change handler */
@@ -1 +1 @@
1
- {"version":3,"file":"PasswordFieldComponent.d.ts","sourceRoot":"","sources":["../../../../src/components/form/fields/PasswordFieldComponent.tsx"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,WAAW,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAExE,OAAO,EAAE,aAAa,EAAoB,MAAM,sBAAsB,CAAC;AAEvE,MAAM,WAAW,2BAA4B,SAAQ,IAAI,CACvD,cAAc,CAAC,OAAO,aAAa,CAAC,EACpC,OAAO,GAAG,UAAU,CACrB;IACC,kBAAkB;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,oBAAoB;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,qBAAqB;IACrB,QAAQ,EAAE,CACR,KAAK,EAAE,WAAW,CAAC,gBAAgB,GAAG,mBAAmB,CAAC,KACvD,IAAI,CAAC;IACV,kBAAkB;IAClB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,6BAA6B;IAC7B,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED;;;;;;;;GAQG;AACH,QAAA,MAAM,sBAAsB,EAAE,aAAa,CAAC,2BAA2B,CAqCtE,CAAC;AAEF,eAAe,sBAAsB,CAAC"}
1
+ {"version":3,"file":"PasswordFieldComponent.d.ts","sourceRoot":"","sources":["../../../../src/components/form/fields/PasswordFieldComponent.tsx"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,WAAW,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAExE,OAAO,EAAE,aAAa,EAAoB,MAAM,sBAAsB,CAAC;AAEvE,MAAM,WAAW,2BAA4B,SAAQ,IAAI,CACvD,cAAc,CAAC,OAAO,aAAa,CAAC,EACpC,OAAO,GAAG,UAAU,CACrB;IACC,kBAAkB;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,uEAAuE;IACvE,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,oBAAoB;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,qBAAqB;IACrB,QAAQ,EAAE,CACR,KAAK,EAAE,WAAW,CAAC,gBAAgB,GAAG,mBAAmB,CAAC,KACvD,IAAI,CAAC;IACV,kBAAkB;IAClB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,6BAA6B;IAC7B,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED;;;;;;;;GAQG;AACH,QAAA,MAAM,sBAAsB,EAAE,aAAa,CAAC,2BAA2B,CAuCtE,CAAC;AAEF,eAAe,sBAAsB,CAAC"}
@@ -1 +1 @@
1
- "use client";import{jsx as a,jsxs as d}from"react/jsx-runtime";import{useId as i}from"react";import{PasswordInput as u,Stack as m}from"@donotdev/components";const p=({label:o,value:s,onChange:t,error:l,helperText:e,...r})=>{const n=i();return d(m,{gap:"tight",children:[a(u,{id:n,value:s??"",onChange:t,label:o,className:"dndev-w-full",required:r.required,...r}),e&&a("p",{style:{fontSize:"var(--font-size-xs)",color:l?"var(--destructive-foreground)":"var(--muted-foreground)",marginTop:"var(--gap-sm)"},children:e})]})};var c=p;export{c as default};
1
+ "use client";import{jsx as a,jsxs as d}from"react/jsx-runtime";import{useId as u}from"react";import{PasswordInput as f,Stack as m}from"@donotdev/components";const p=({label:o,info:s,value:t,onChange:n,error:i,helperText:e,...r})=>{const l=u();return d(m,{gap:"tight",children:[a(f,{id:l,value:t??"",onChange:n,label:o,info:s,className:"dndev-w-full",required:r.required,...r}),e&&a("p",{style:{fontSize:"var(--font-size-xs)",color:i?"var(--destructive-foreground)":"var(--muted-foreground)",marginTop:"var(--gap-sm)"},children:e})]})};var c=p;export{c as default};
@@ -1,7 +1,17 @@
1
- import type { ChangeEvent, ComponentType } from 'react';
1
+ import type { ChangeEvent, ComponentProps, ComponentType } from 'react';
2
+ import { Input } from '@donotdev/components';
3
+ /** Props for the phone input, including native form identity, blur, and ref wiring. */
2
4
  export interface PhoneNumberComponentProps {
5
+ /** Name of the telephone input in the form */
6
+ name?: ComponentProps<typeof Input>['name'];
7
+ /** Blur handler for the telephone input */
8
+ onBlur?: ComponentProps<typeof Input>['onBlur'];
9
+ /** React 19 native ref targeting the telephone input */
10
+ ref?: ComponentProps<typeof Input>['ref'];
3
11
  /** Field label */
4
12
  label: string;
13
+ /** Help text (entity field `hint`): an (i) after the label shows it */
14
+ info?: string;
5
15
  /** Current phone number value (full number with country code) */
6
16
  value?: string;
7
17
  /** Change handler */
@@ -1 +1 @@
1
- {"version":3,"file":"PhoneNumberComponent.d.ts","sourceRoot":"","sources":["../../../../src/components/form/fields/PhoneNumberComponent.tsx"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAexD,MAAM,WAAW,yBAAyB;IACxC,kBAAkB;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,iEAAiE;IACjE,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,qBAAqB;IACrB,QAAQ,EAAE,CAAC,KAAK,EAAE,WAAW,CAAC,gBAAgB,CAAC,KAAK,IAAI,CAAC;IACzD,oBAAoB;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,kBAAkB;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,+BAA+B;IAC/B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,qBAAqB;IACrB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,gDAAgD;IAChD,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,oCAAoC;IACpC,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,4EAA4E;IAC5E,kBAAkB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC9B,yFAAyF;IACzF,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;CACtB;AAED;;;;;;GAMG;AACH,QAAA,MAAM,oBAAoB,EAAE,aAAa,CAAC,yBAAyB,CA8PlE,CAAC;AAEF,eAAe,oBAAoB,CAAC"}
1
+ {"version":3,"file":"PhoneNumberComponent.d.ts","sourceRoot":"","sources":["../../../../src/components/form/fields/PhoneNumberComponent.tsx"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,WAAW,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAExE,OAAO,EACL,KAAK,EAON,MAAM,sBAAsB,CAAC;AAK9B,uFAAuF;AACvF,MAAM,WAAW,yBAAyB;IACxC,8CAA8C;IAC9C,IAAI,CAAC,EAAE,cAAc,CAAC,OAAO,KAAK,CAAC,CAAC,MAAM,CAAC,CAAC;IAC5C,2CAA2C;IAC3C,MAAM,CAAC,EAAE,cAAc,CAAC,OAAO,KAAK,CAAC,CAAC,QAAQ,CAAC,CAAC;IAChD,wDAAwD;IACxD,GAAG,CAAC,EAAE,cAAc,CAAC,OAAO,KAAK,CAAC,CAAC,KAAK,CAAC,CAAC;IAC1C,kBAAkB;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,uEAAuE;IACvE,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,iEAAiE;IACjE,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,qBAAqB;IACrB,QAAQ,EAAE,CAAC,KAAK,EAAE,WAAW,CAAC,gBAAgB,CAAC,KAAK,IAAI,CAAC;IACzD,oBAAoB;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,kBAAkB;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,+BAA+B;IAC/B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,qBAAqB;IACrB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,gDAAgD;IAChD,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,oCAAoC;IACpC,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,4EAA4E;IAC5E,kBAAkB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC9B,yFAAyF;IACzF,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;CACtB;AAED;;;;;;GAMG;AACH,QAAA,MAAM,oBAAoB,EAAE,aAAa,CAAC,yBAAyB,CAuQlE,CAAC;AAEF,eAAe,oBAAoB,CAAC"}
@@ -1 +1 @@
1
- "use client";import{jsx as i,jsxs as s}from"react/jsx-runtime";import{useState as L,useMemo as h,useEffect as M,useId as O}from"react";import{Input as j,FloatingLabel as q,Button as B,BUTTON_VARIANT as E,DropdownMenu as U,Stack as f,cn as D}from"@donotdev/components";import{Flag as R,COUNTRIES as y}from"@donotdev/core";const V=({label:F,value:d="",onChange:C,error:N,helperText:g,required:S=!1,disabled:v=!1,defaultCountry:x="FR",showFlags:T=!0,preferredCountries:c,countries:m})=>{const n=O(),p=h(()=>m&&m.length>0?m.map(e=>y.find(r=>r.code===e)).filter(e=>e!==void 0):Array.from(y),[m]),l=h(()=>{if(!c||c.length===0)return p;const e=c.map(t=>p.find(k=>k.code===t)).filter(t=>t!==void 0),r=p.filter(t=>!c.includes(t.code));return[...e,...r]},[p,c]),u=h(()=>l.find(e=>e.code===x)||l[0]||y[0],[x,l]),{country:b,phoneNumber:$}=h(()=>{if(!d)return{country:u,phoneNumber:""};const e=l.find(t=>d.startsWith(t.dialCode));if(e){let t=d.slice(e.dialCode.length).trim();return t.startsWith("0")&&(t=t.slice(1).trim()),t=t.replace(/\s+/g," ").trim(),{country:e,phoneNumber:t}}if(d.startsWith("+"))return{country:u,phoneNumber:d};let r=d.trim();return r.startsWith("0")&&(r=r.slice(1).trim()),r=r.replace(/\s+/g," ").trim(),{country:u,phoneNumber:r}},[d,u,l]),[a,W]=L(u);M(()=>{b.code!==a.code&&W(b)},[b,a.code]);const z=$,w=e=>{W(e);let r=z;r.startsWith("0")&&(r=r.slice(1).trim()),r=r.replace(/\s+/g," ").trim();const t={target:{value:e.dialCode+(r?" "+r:"")}};C(t)},A=e=>{let r=e.target.value;r.startsWith("0")&&(r=r.slice(1).trim()),r=r.replace(/\s+/g," ").trim();const t={target:{value:a.dialCode+(r?" "+r:"")}};C(t)},I=l.map(e=>({label:e.dialCode,onClick:()=>w(e),checked:e.code===a.code,children:T?s(f,{direction:"row",align:"center",gap:"tight",children:[i(R,{code:e.flagCode,title:e.name}),i("span",{children:e.dialCode}),i("span",{style:{color:"var(--muted-foreground)",fontSize:"var(--font-size-xs)"},children:e.name})]}):s("span",{children:[e.dialCode," ",e.name]})})),o=!!N;return s(f,{gap:"tight",children:[i(q,{htmlFor:n,label:F,disabled:v,required:S,children:s("div",{className:"dndev-relative",style:{display:"flex",gap:0},children:[i(U,{trigger:i(B,{type:"button",variant:E.GHOST,disabled:v,style:{minWidth:"fit-content",padding:"0 var(--gap-md)"},"aria-label":`Country code: ${a.dialCode}`,children:s(f,{direction:"row",align:"center",gap:"tight",children:[T&&i(R,{code:a.flagCode,title:a.name}),i("span",{children:a.dialCode})]})}),items:I,contentWidth:"16rem"}),i(j,{id:n,type:"tel",inputMode:"tel",value:z,onChange:A,disabled:v,placeholder:"6 12 34 56 78",bare:!0,"data-variant":o?"destructive":void 0,className:"dndev-flex-1",style:{borderTopLeftRadius:0,borderBottomLeftRadius:0,borderRadius:"0 var(--radius-md) var(--radius-md) 0"},"aria-describedby":D(o&&`${n}-error`,g&&!o&&`${n}-helper`),"aria-invalid":o})]})}),o&&s(f,{id:`${n}-error`,direction:"row",align:"center",gap:"tight",style:{fontSize:"var(--font-size-xs)",color:"var(--destructive-foreground)"},role:"alert",children:[i("span",{children:"\u26A0"}),N]}),g&&!o&&i("p",{id:`${n}-helper`,style:{fontSize:"var(--font-size-xs)",color:"var(--muted-foreground)"},children:g})]})};var _=V;export{_ as default};
1
+ "use client";import{jsx as a,jsxs as s}from"react/jsx-runtime";import{useState as q,useMemo as p,useEffect as E,useId as U}from"react";import{Input as j,FloatingLabel as D,Button as G,BUTTON_VARIANT as H,DropdownMenu as V,Stack as f,cn as _}from"@donotdev/components";import{Flag as T,COUNTRIES as y}from"@donotdev/core";const P=({label:W,info:R,value:i="",onChange:C,name:w,onBlur:A,ref:B,error:$,helperText:g,required:F=!1,disabled:v=!1,defaultCountry:N="FR",showFlags:x=!0,preferredCountries:c,countries:h})=>{const o=U(),m=p(()=>h&&h.length>0?h.map(e=>y.find(r=>r.code===e)).filter(e=>e!==void 0):Array.from(y),[h]),n=p(()=>{if(!c||c.length===0)return m;const e=c.map(t=>m.find(O=>O.code===t)).filter(t=>t!==void 0),r=m.filter(t=>!c.includes(t.code));return[...e,...r]},[m,c]),u=p(()=>n.find(e=>e.code===N)||n[0]||y[0],[N,n]),{country:b,phoneNumber:k}=p(()=>{if(!i)return{country:u,phoneNumber:""};const e=n.find(t=>i.startsWith(t.dialCode));if(e){let t=i.slice(e.dialCode.length).trim();return t.startsWith("0")&&(t=t.slice(1).trim()),t=t.replace(/\s+/g," ").trim(),{country:e,phoneNumber:t}}if(i.startsWith("+"))return{country:u,phoneNumber:i};let r=i.trim();return r.startsWith("0")&&(r=r.slice(1).trim()),r=r.replace(/\s+/g," ").trim(),{country:u,phoneNumber:r}},[i,u,n]),[d,S]=q(u);E(()=>{i&&b.code!==d.code&&S(b)},[i,b,d.code]);const z=k,I=e=>{S(e);let r=z;r.startsWith("0")&&(r=r.slice(1).trim()),r=r.replace(/\s+/g," ").trim();const t={target:{value:r?`${e.dialCode} ${r}`:""}};C(t)},L=e=>{let r=e.target.value;r.startsWith("0")&&(r=r.slice(1).trim()),r=r.replace(/\s+/g," ").trim();const t={target:{value:r?`${d.dialCode} ${r}`:""}};C(t)},M=n.map(e=>({label:e.dialCode,onClick:()=>I(e),checked:e.code===d.code,children:x?s(f,{direction:"row",align:"center",gap:"tight",children:[a(T,{code:e.flagCode,title:e.name}),a("span",{children:e.dialCode}),a("span",{style:{color:"var(--muted-foreground)",fontSize:"var(--font-size-xs)"},children:e.name})]}):s("span",{children:[e.dialCode," ",e.name]})})),l=!!$;return s(f,{gap:"tight",children:[a(D,{htmlFor:o,label:W,info:R,disabled:v,required:F,children:s("div",{className:"dndev-relative",style:{display:"flex",gap:0},children:[a(V,{trigger:a(G,{type:"button",variant:H.GHOST,disabled:v,style:{minWidth:"fit-content",padding:"0 var(--gap-md)"},"aria-label":`Country code: ${d.dialCode}`,children:s(f,{direction:"row",align:"center",gap:"tight",children:[x&&a(T,{code:d.flagCode,title:d.name}),a("span",{children:d.dialCode})]})}),items:M,contentWidth:"16rem"}),a(j,{ref:B,name:w,onBlur:A,id:o,type:"tel",inputMode:"tel",value:z,onChange:L,disabled:v,placeholder:"6 12 34 56 78",bare:!0,"data-variant":l?"destructive":void 0,className:"dndev-flex-1",style:{borderTopLeftRadius:0,borderBottomLeftRadius:0,borderRadius:"0 var(--radius-md) var(--radius-md) 0"},"aria-describedby":_(l&&`${o}-error`,g&&!l&&`${o}-helper`),"aria-invalid":l})]})}),l&&s(f,{id:`${o}-error`,direction:"row",align:"center",gap:"tight",style:{fontSize:"var(--font-size-xs)",color:"var(--destructive-foreground)"},role:"alert",children:[a("span",{children:"\u26A0"}),$]}),g&&!l&&a("p",{id:`${o}-helper`,style:{fontSize:"var(--font-size-xs)",color:"var(--muted-foreground)"},children:g})]})};var Y=P;export{Y as default};
@@ -8,6 +8,8 @@ export interface PriceValue {
8
8
  export interface PriceFieldComponentProps {
9
9
  /** Field label (for amount) */
10
10
  label: string;
11
+ /** Help text (entity field `hint`): an (i) after the label shows it */
12
+ info?: string;
11
13
  /** Current value */
12
14
  value?: PriceValue | null;
13
15
  /** Change handler */
@@ -1 +1 @@
1
- {"version":3,"file":"PriceFieldComponent.d.ts","sourceRoot":"","sources":["../../../../src/components/form/fields/PriceFieldComponent.tsx"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAe,aAAa,EAAE,MAAM,OAAO,CAAC;AAaxD,MAAM,WAAW,UAAU;IACzB,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED,MAAM,WAAW,wBAAwB;IACvC,+BAA+B;IAC/B,KAAK,EAAE,MAAM,CAAC;IACd,oBAAoB;IACpB,KAAK,CAAC,EAAE,UAAU,GAAG,IAAI,CAAC;IAC1B,qBAAqB;IACrB,QAAQ,EAAE,CAAC,KAAK,EAAE,UAAU,KAAK,IAAI,CAAC;IACtC,kBAAkB;IAClB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,kBAAkB;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,eAAe;IACf,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,eAAe;IACf,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,6BAA6B;IAC7B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,oDAAoD;IACpD,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,oCAAoC;IACpC,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,0GAA0G;IAC1G,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;CACvB;AAYD,QAAA,MAAM,mBAAmB,EAAE,aAAa,CAAC,wBAAwB,CAwMhE,CAAC;AAEF,eAAe,mBAAmB,CAAC"}
1
+ {"version":3,"file":"PriceFieldComponent.d.ts","sourceRoot":"","sources":["../../../../src/components/form/fields/PriceFieldComponent.tsx"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAe,aAAa,EAAE,MAAM,OAAO,CAAC;AAaxD,MAAM,WAAW,UAAU;IACzB,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED,MAAM,WAAW,wBAAwB;IACvC,+BAA+B;IAC/B,KAAK,EAAE,MAAM,CAAC;IACd,uEAAuE;IACvE,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,oBAAoB;IACpB,KAAK,CAAC,EAAE,UAAU,GAAG,IAAI,CAAC;IAC1B,qBAAqB;IACrB,QAAQ,EAAE,CAAC,KAAK,EAAE,UAAU,KAAK,IAAI,CAAC;IACtC,kBAAkB;IAClB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,kBAAkB;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,eAAe;IACf,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,eAAe;IACf,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,6BAA6B;IAC7B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,oDAAoD;IACpD,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,oCAAoC;IACpC,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,0GAA0G;IAC1G,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;CACvB;AAYD,QAAA,MAAM,mBAAmB,EAAE,aAAa,CAAC,wBAAwB,CA0MhE,CAAC;AAEF,eAAe,mBAAmB,CAAC"}
@@ -1 +1 @@
1
- "use client";import{jsx as n,jsxs as u}from"react/jsx-runtime";import{CirclePlus as R,CircleMinus as U}from"lucide-react";import{useId as q,useState as z}from"react";import{Input as C,Checkbox as D,Stack as E,Select as A,CollapsiblePrimitive as B,CollapsibleTrigger as G,CollapsibleContent as H}from"@donotdev/components";import{useTranslation as J,getCurrencySymbol as L}from"@donotdev/core";const O=["EUR","USD","GBP","CHF","JPY","KRW"],Y=({label:f,value:a,onChange:I,error:s,helperText:g,required:P=!1,disabled:o=!1,placeholder:N="0",defaultCurrency:d="EUR",optionsTitle:x="Price options",currencies:b})=>{const c=q(),{t:p}=J("crud"),r=b?.length?b:[...O],h=a?.currency??d,m=r.includes(h)?h:r[0]??d,T=a?.vatIncluded??!0,y=a?.discountPercent??0,S=`${f} (${L(m)})`,i=e=>{const l=e.amount!==void 0?e.amount:a?.amount??null;let t=e.currency!==void 0?e.currency:a?.currency??d;r.includes(t)||(t=m);const F=e.vatIncluded!==void 0?e.vatIncluded:a?.vatIncluded??!0,M=e.discountPercent!==void 0?e.discountPercent:a?.discountPercent??0;I({amount:l===null?null:Number(l),currency:t,vatIncluded:F,discountPercent:Number(M)})},k=e=>{const l=e.target.value;if(l===""||l===null){i({amount:null});return}const t=parseFloat(l);i({amount:isNaN(t)?null:t})},V=e=>{i({currency:e||d})},$=e=>{const l=e.target.value;if(l===""||l===null){i({discountPercent:0});return}const t=parseFloat(l);i({discountPercent:isNaN(t)?0:t})},[v,j]=z(!1);return u(B,{open:v,onOpenChange:j,children:[u(E,{children:[u("div",{style:{display:"grid",gridTemplateColumns:"1fr auto",gap:"var(--gap-sm)",alignItems:"end"},children:[n(C,{id:c,type:"number",inputMode:"decimal",label:S,value:a?.amount!==void 0&&a?.amount!==null?a.amount:"",onChange:k,disabled:o,placeholder:N,required:P,min:0,step:.01,"data-variant":s?"destructive":void 0,"aria-invalid":s}),n(G,{asChild:!0,children:n("button",{type:"button","aria-label":x,"aria-expanded":v,className:"dndev-collapsible-trigger",style:{display:"flex",alignItems:"center",justifyContent:"center",padding:"var(--gap-sm)",background:"none",border:"none",cursor:"pointer"},children:v?n(U,{className:"dndev-collapsible-icon","aria-hidden":"true"}):n(R,{className:"dndev-collapsible-icon","aria-hidden":"true"})})})]}),n(H,{className:"dndev-collapsible-content",children:u("div",{style:{display:"grid",gridTemplateColumns:r.length>1?"1fr auto 1fr":"auto 1fr",gap:"var(--gap-sm)",alignItems:"end",paddingTop:"var(--gap-md)"},children:[r.length>1&&n(A,{value:m,onValueChange:V,placeholder:d,options:r.map(e=>({value:e,label:e})),disabled:o,label:p("price.currency",{defaultValue:"Currency"})}),n(D,{id:`${c}-vat`,label:p("price.vatIncluded",{defaultValue:"VAT Incl."}),checked:T,onCheckedChange:e=>i({vatIncluded:e===!0}),disabled:o}),n(C,{id:`${c}-discount`,type:"number",inputMode:"decimal",min:0,max:100,step:1,value:y===0?"":y,onChange:$,disabled:o,placeholder:"0",label:p("price.discountLabel",{defaultValue:"Discount (%)"})})]})})]}),g&&n("p",{style:{fontSize:"var(--font-size-xs)",color:s?"var(--destructive-foreground)":"var(--muted-foreground)"},children:g})]})};var w=Y;export{w as default};
1
+ "use client";import{jsx as l,jsxs as c}from"react/jsx-runtime";import{CirclePlus as q,CircleMinus as z}from"lucide-react";import{useId as E,useState as B}from"react";import{Input as C,Checkbox as D,Stack as G,Select as H,CollapsiblePrimitive as J,CollapsibleTrigger as K,CollapsibleContent as L}from"@donotdev/components";import{useTranslation as O,getCurrencySymbol as V}from"@donotdev/core";const Y=["EUR","USD","GBP","CHF","JPY","KRW"],w=({label:f,info:I,value:a,onChange:P,error:s,helperText:g,required:N=!1,disabled:o=!1,placeholder:x="0",defaultCurrency:d="EUR",optionsTitle:T="Price options",currencies:b})=>{const u=E(),{t:p}=O("crud"),t=b?.length?b:[...Y],h=a?.currency??d,m=t.includes(h)?h:t[0]??d,k=a?.vatIncluded??!0,y=a?.discountPercent??0,S=`${f} (${V(m)})`,i=e=>{const n=e.amount!==void 0?e.amount:a?.amount??null;let r=e.currency!==void 0?e.currency:a?.currency??d;t.includes(r)||(r=m);const R=e.vatIncluded!==void 0?e.vatIncluded:a?.vatIncluded??!0,U=e.discountPercent!==void 0?e.discountPercent:a?.discountPercent??0;P({amount:n===null?null:Number(n),currency:r,vatIncluded:R,discountPercent:Number(U)})},$=e=>{const n=e.target.value;if(n===""||n===null){i({amount:null});return}const r=parseFloat(n);i({amount:isNaN(r)?null:r})},j=e=>{i({currency:e||d})},F=e=>{const n=e.target.value;if(n===""||n===null){i({discountPercent:0});return}const r=parseFloat(n);i({discountPercent:isNaN(r)?0:r})},[v,M]=B(!1);return c(J,{open:v,onOpenChange:M,children:[c(G,{children:[c("div",{style:{display:"grid",gridTemplateColumns:"1fr auto",gap:"var(--gap-sm)",alignItems:"end"},children:[l(C,{id:u,type:"number",inputMode:"decimal",label:S,info:I,value:a?.amount!==void 0&&a?.amount!==null?a.amount:"",onChange:$,disabled:o,placeholder:x,required:N,min:0,step:.01,"data-variant":s?"destructive":void 0,"aria-invalid":s}),l(K,{asChild:!0,children:l("button",{type:"button","aria-label":T,"aria-expanded":v,className:"dndev-collapsible-trigger",style:{display:"flex",alignItems:"center",justifyContent:"center",padding:"var(--gap-sm)",background:"none",border:"none",cursor:"pointer"},children:v?l(z,{className:"dndev-collapsible-icon","aria-hidden":"true"}):l(q,{className:"dndev-collapsible-icon","aria-hidden":"true"})})})]}),l(L,{className:"dndev-collapsible-content",children:c("div",{style:{display:"grid",gridTemplateColumns:t.length>1?"1fr auto 1fr":"auto 1fr",gap:"var(--gap-sm)",alignItems:"end",paddingTop:"var(--gap-md)"},children:[t.length>1&&l(H,{value:m,onValueChange:j,placeholder:d,options:t.map(e=>({value:e,label:e})),disabled:o,label:p("price.currency")}),l(D,{id:`${u}-vat`,label:p("price.vatIncluded"),checked:k,onCheckedChange:e=>i({vatIncluded:e===!0}),disabled:o}),l(C,{id:`${u}-discount`,type:"number",inputMode:"decimal",min:0,max:100,step:1,value:y===0?"":y,onChange:F,disabled:o,placeholder:"0",label:p("price.discountLabel")})]})})]}),g&&l("p",{style:{fontSize:"var(--font-size-xs)",color:s?"var(--destructive-foreground)":"var(--muted-foreground)"},children:g})]})};var A=w;export{A as default};
@@ -1 +1 @@
1
- import{jsx as e,jsxs as l}from"react/jsx-runtime";import{Label as h,Slider as b,Stack as d}from"@donotdev/components";const x=({label:t,value:i=0,onChange:u,error:n,helperText:s,min:r=0,max:c=100,step:v=1,disabled:o,required:m,showValue:f=!0})=>{const g=a=>{const p={target:{value:a.toString()}};u(p)};return l(d,{gap:"tight",children:[l(d,{direction:"row",justify:"between",align:"center",children:[e(h,{required:m,style:{fontSize:"var(--font-size-sm)",fontWeight:500},children:t}),f&&e("span",{style:{fontSize:"var(--font-size-sm)",color:"var(--muted-foreground)"},children:i})]}),e(b,{value:[i??r],onValueChange:([a])=>g(a??r),min:r,max:c,step:v,disabled:o,style:{borderColor:n?"var(--destructive)":void 0,opacity:o?"var(--opacity-muted)":void 0,cursor:o?"not-allowed":void 0},"aria-label":t}),s&&e("p",{style:{fontSize:"var(--font-size-xs)",color:n?"var(--destructive-foreground)":"var(--muted-foreground)",marginTop:"var(--gap-sm)"},children:s})]})};var y=x;export{y as default};
1
+ import{jsx as e,jsxs as l}from"react/jsx-runtime";import{Label as h,Slider as b,Stack as d}from"@donotdev/components";const x=({label:a,value:i=0,onChange:u,error:n,helperText:s,min:r=0,max:c=100,step:v=1,disabled:t,required:m,showValue:f=!0})=>{const g=o=>{const p={target:{value:o.toString()}};u(p)};return l(d,{gap:"tight",children:[l(d,{direction:"row",justify:"between",align:"center",children:[e(h,{required:m,style:{fontSize:"var(--font-size-sm)",fontWeight:500},children:a}),f&&e("span",{style:{fontSize:"var(--font-size-sm)",color:"var(--muted-foreground)"},children:i})]}),e(b,{value:[i??r],onValueChange:([o])=>g(o??r),min:r,max:c,step:v,disabled:t,style:{borderColor:n?"var(--destructive)":void 0,opacity:t?"var(--opacity-muted)":void 0,cursor:t?"not-allowed":void 0},"aria-label":a}),s&&e("p",{style:{fontSize:"var(--font-size-xs)",color:n?"var(--destructive-foreground)":"var(--muted-foreground)",marginTop:"var(--gap-sm)"},children:s})]})};var y=x;export{y as default};
@@ -1 +1 @@
1
- import{jsx as e,jsxs as g}from"react/jsx-runtime";import{Label as h,Rating as m,Stack as f}from"@donotdev/components";const v=({label:a,value:o=0,onChange:s,error:l,helperText:r,max:t=5,disabled:i,required:n,readonly:d,showValue:u=!1})=>g(f,{gap:"tight",children:[e(h,{required:n,style:{fontSize:"var(--font-size-sm)",fontWeight:500},children:a}),e(m,{value:o,onChange:s,max:t,disabled:i,readonly:d,showValue:u,"aria-label":a}),r&&e("p",{style:{fontSize:"var(--font-size-xs)",color:l?"var(--destructive-foreground)":"var(--muted-foreground)",marginTop:"var(--gap-sm)"},children:r})]});var p=v;export{p as default};
1
+ import{jsx as e,jsxs as g}from"react/jsx-runtime";import{Label as h,Rating as m,Stack as u}from"@donotdev/components";const v=({label:a,value:o=0,onChange:s,error:l,helperText:r,max:t=5,disabled:i,required:n,readonly:d,showValue:f=!1})=>g(u,{gap:"tight",children:[e(h,{required:n,style:{fontSize:"var(--font-size-sm)",fontWeight:500},children:a}),e(m,{value:o,onChange:s,max:t,disabled:i,readonly:d,showValue:f,"aria-label":a}),r&&e("p",{style:{fontSize:"var(--font-size-xs)",color:l?"var(--destructive-foreground)":"var(--muted-foreground)",marginTop:"var(--gap-sm)"},children:r})]});var p=v;export{p as default};
@@ -13,6 +13,8 @@ export interface ReferenceOption {
13
13
  export interface ReferenceFieldComponentProps {
14
14
  /** Field label */
15
15
  label: string;
16
+ /** Help text (entity field `hint`): an (i) after the label shows it */
17
+ info?: string;
16
18
  /** Selected reference document ID */
17
19
  value?: string;
18
20
  /** Change handler - receives selected ID */
@@ -53,6 +55,6 @@ export interface ReferenceFieldComponentProps {
53
55
  * />
54
56
  * ```
55
57
  */
56
- declare const ReferenceFieldComponent: ({ label, value, onChange, options, isLoading, error, helperText, required, onBlur, onCreate, placeholder, }: ReferenceFieldComponentProps) => import("react").JSX.Element;
58
+ declare const ReferenceFieldComponent: ({ label, info, value, onChange, options, isLoading, error, helperText, required, onBlur, onCreate, placeholder, }: ReferenceFieldComponentProps) => import("react").JSX.Element;
57
59
  export default ReferenceFieldComponent;
58
60
  //# sourceMappingURL=ReferenceFieldComponent.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ReferenceFieldComponent.d.ts","sourceRoot":"","sources":["../../../../src/components/form/fields/ReferenceFieldComponent.tsx"],"names":[],"mappings":"AAmBA,wCAAwC;AACxC,MAAM,WAAW,eAAe;IAC9B,kBAAkB;IAClB,EAAE,EAAE,MAAM,CAAC;IACX,iCAAiC;IACjC,KAAK,EAAE,MAAM,CAAC;IACd,sCAAsC;IACtC,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED;;GAEG;AACH,MAAM,WAAW,4BAA4B;IAC3C,kBAAkB;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,qCAAqC;IACrC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,4CAA4C;IAC5C,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC,uCAAuC;IACvC,OAAO,EAAE,eAAe,EAAE,CAAC;IAC3B,oBAAoB;IACpB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,kBAAkB;IAClB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,kBAAkB;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,oCAAoC;IACpC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,mBAAmB;IACnB,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;IACpB,gEAAgE;IAChE,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;IACtB,uBAAuB;IACvB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,QAAA,MAAM,uBAAuB,GAAI,6GAY9B,4BAA4B,gCA4E9B,CAAC;AAEF,eAAe,uBAAuB,CAAC"}
1
+ {"version":3,"file":"ReferenceFieldComponent.d.ts","sourceRoot":"","sources":["../../../../src/components/form/fields/ReferenceFieldComponent.tsx"],"names":[],"mappings":"AAmBA,wCAAwC;AACxC,MAAM,WAAW,eAAe;IAC9B,kBAAkB;IAClB,EAAE,EAAE,MAAM,CAAC;IACX,iCAAiC;IACjC,KAAK,EAAE,MAAM,CAAC;IACd,sCAAsC;IACtC,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED;;GAEG;AACH,MAAM,WAAW,4BAA4B;IAC3C,kBAAkB;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,uEAAuE;IACvE,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,qCAAqC;IACrC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,4CAA4C;IAC5C,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC,uCAAuC;IACvC,OAAO,EAAE,eAAe,EAAE,CAAC;IAC3B,oBAAoB;IACpB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,kBAAkB;IAClB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,kBAAkB;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,oCAAoC;IACpC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,mBAAmB;IACnB,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;IACpB,gEAAgE;IAChE,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;IACtB,uBAAuB;IACvB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,QAAA,MAAM,uBAAuB,GAAI,mHAa9B,4BAA4B,gCA6E9B,CAAC;AAEF,eAAe,uBAAuB,CAAC"}
@@ -1 +1 @@
1
- import{jsx as t,jsxs as d}from"react/jsx-runtime";import"lucide-react";import{useMemo as S,useId as A}from"react";import{Combobox as $,Stack as c}from"@donotdev/components";import{useTranslation as j}from"@donotdev/core";const q=({label:r,value:l,onChange:p,options:n,isLoading:u=!1,error:f,helperText:o,required:h,onBlur:m,onCreate:I,placeholder:g})=>{const{t:s}=j("crud"),i=A(),v=S(()=>n.map(e=>({value:e.id,label:e.label,description:e.description})),[n]),b=e=>{const z=Array.isArray(e)?e[0]||"":e;p(z)},x=e=>{e||m?.()},a=!!f,y=`${i}-error`,C=`${i}-helper`;return d(c,{gap:"tight",children:[t($,{label:r,value:l||"",onValueChange:b,onOpenChange:x,placeholder:g||s("reference.placeholder",{label:r})||`Select ${r}`,emptyMessage:s("reference.noResults")||"No results found",options:v,required:h,variant:a?"destructive":void 0,isLoading:u,clearable:!!l}),a&&d(c,{id:y,direction:"row",align:"center",gap:"tight",style:{fontSize:"var(--font-size-xs)",color:"var(--destructive-foreground)"},role:"alert",children:[t("span",{children:"\u26A0"}),o]}),o&&!a&&t("p",{id:C,style:{fontSize:"var(--font-size-xs)",color:"var(--muted-foreground)"},children:o})]})};var L=q;export{L as default};
1
+ import{jsx as t,jsxs as d}from"react/jsx-runtime";import"lucide-react";import{useMemo as A,useId as $}from"react";import{Combobox as j,Stack as c}from"@donotdev/components";import{useTranslation as q}from"@donotdev/core";const L=({label:r,info:p,value:l,onChange:u,options:n,isLoading:f=!1,error:h,helperText:o,required:m,onBlur:g,onCreate:I,placeholder:v})=>{const{t:s}=q("crud"),i=$(),b=A(()=>n.map(e=>({value:e.id,label:e.label,description:e.description})),[n]),x=e=>{const S=Array.isArray(e)?e[0]||"":e;u(S)},y=e=>{e||g?.()},a=!!h,C=`${i}-error`,z=`${i}-helper`;return d(c,{gap:"tight",children:[t(j,{label:r,info:p,value:l||"",onValueChange:x,onOpenChange:y,placeholder:v||s("reference.placeholder",{label:r})||`Select ${r}`,emptyMessage:s("reference.noResults")||"No results found",options:b,required:m,variant:a?"destructive":void 0,isLoading:f,clearable:!!l}),a&&d(c,{id:C,direction:"row",align:"center",gap:"tight",style:{fontSize:"var(--font-size-xs)",color:"var(--destructive-foreground)"},role:"alert",children:[t("span",{children:"\u26A0"}),o]}),o&&!a&&t("p",{id:z,style:{fontSize:"var(--font-size-xs)",color:"var(--muted-foreground)"},children:o})]})};var M=L;export{M as default};
@@ -1 +1 @@
1
- "use client";import{jsx as e}from"react/jsx-runtime";import{lazy as m,Suspense as b,useState as f,useEffect as g}from"react";import{Stack as v}from"@donotdev/components";import h from"./TextAreaComponent";const p=m(()=>typeof window<"u"?import("./internal/TiptapEditor").catch(()=>({default:()=>null})):Promise.resolve({default:()=>null})),x=({label:l,value:a="",onChange:r,error:s,helperText:o,required:d,disabled:t,placeholder:c,className:n})=>{const[i,u]=f(!1);return g(()=>{u(!0)},[]),i?e(v,{gap:"tight",children:e(b,{fallback:e(h,{label:l,value:a,onChange:r,error:s,helperText:o,required:d,disabled:t,placeholder:c,className:n}),children:p?e(p,{label:l,value:a,onChange:r,error:s,helperText:o,required:d,disabled:t,placeholder:c,className:n}):e(h,{label:l,value:a,onChange:r,error:s,helperText:o,required:d,disabled:t,placeholder:c,className:n})})}):e(h,{label:l,value:a,onChange:r,error:s,helperText:o,required:d,disabled:t,placeholder:c,className:n})};var C=x;export{C as default};
1
+ "use client";import{jsx as e}from"react/jsx-runtime";import{lazy as m,Suspense as b,useState as f,useEffect as g}from"react";import{Stack as v}from"@donotdev/components";import h from"./TextAreaComponent";const p=m(()=>typeof window<"u"?import("./internal/TiptapEditor").catch(()=>({default:()=>null})):Promise.resolve({default:()=>null})),x=({label:l,value:a="",onChange:r,error:s,helperText:o,required:d,disabled:t,placeholder:i,className:u})=>{const[c,n]=f(!1);return g(()=>{n(!0)},[]),c?e(v,{gap:"tight",children:e(b,{fallback:e(h,{label:l,value:a,onChange:r,error:s,helperText:o,required:d,disabled:t,placeholder:i,className:u}),children:p?e(p,{label:l,value:a,onChange:r,error:s,helperText:o,required:d,disabled:t,placeholder:i,className:u}):e(h,{label:l,value:a,onChange:r,error:s,helperText:o,required:d,disabled:t,placeholder:i,className:u})})}):e(h,{label:l,value:a,onChange:r,error:s,helperText:o,required:d,disabled:t,placeholder:i,className:u})};var C=x;export{C as default};
@@ -1 +1 @@
1
- {"version":3,"file":"SwitchFieldComponent.d.ts","sourceRoot":"","sources":["../../../../src/components/form/fields/SwitchFieldComponent.tsx"],"names":[],"mappings":"AAEA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAIxD,MAAM,WAAW,yBAAyB;IACxC,kBAAkB;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,oCAAoC;IACpC,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,qBAAqB;IACrB,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,WAAW,CAAC,gBAAgB,CAAC,KAAK,IAAI,CAAC;IAC1D,iDAAiD;IACjD,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,kDAAkD;IAClD,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,kBAAkB;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED;;;;;;;;;GASG;AACH,QAAA,MAAM,oBAAoB,EAAE,aAAa,CAAC,yBAAyB,CAuClE,CAAC;AAEF,eAAe,oBAAoB,CAAC"}
1
+ {"version":3,"file":"SwitchFieldComponent.d.ts","sourceRoot":"","sources":["../../../../src/components/form/fields/SwitchFieldComponent.tsx"],"names":[],"mappings":"AAEA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAMxD,MAAM,WAAW,yBAAyB;IACxC,kBAAkB;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,oCAAoC;IACpC,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,qBAAqB;IACrB,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,WAAW,CAAC,gBAAgB,CAAC,KAAK,IAAI,CAAC;IAC1D,iDAAiD;IACjD,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,kDAAkD;IAClD,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,kBAAkB;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED;;;;;;;;;GASG;AACH,QAAA,MAAM,oBAAoB,EAAE,aAAa,CAAC,yBAAyB,CAsClE,CAAC;AAEF,eAAe,oBAAoB,CAAC"}
@@ -1 +1 @@
1
- import{jsxs as e,jsx as c}from"react/jsx-runtime";import{Switch as k,Text as r,Stack as n}from"@donotdev/components";const p=({label:a,checked:d=!1,onChange:l,uncheckedLabel:h,checkedLabel:i,helperText:t})=>{const s=o=>{l&&l({target:{checked:o}})};return e(n,{gap:"tight",children:[e(n,{direction:"row",align:"center",style:{flexWrap:"wrap"},children:[e(r,{level:"body",textAlign:"start",children:[a,":"]}),c(k,{checked:d,onCheckedChange:s,"aria-label":a,variant:"muted",uncheckedLabel:h,checkedLabel:i})]}),t&&c(r,{as:"p",variant:"muted",level:"small",children:t})]})};var g=p;export{g as default};
1
+ import{jsx as e,jsxs as n}from"react/jsx-runtime";import{Switch as i,Text as s,Stack as o}from"@donotdev/components";import{InlineFieldRow as m}from"./internal/InlineFieldRow";const k=({label:t,checked:a=!1,onChange:c,uncheckedLabel:r,checkedLabel:h,helperText:l})=>n(o,{gap:"tight",children:[e(m,{children:e(i,{checked:a,onCheckedChange:d=>{c&&c({target:{checked:d}})},label:t,variant:a?"primary":"muted",uncheckedLabel:r,checkedLabel:h})}),l&&e(s,{as:"p",variant:"muted",level:"small",children:l})]});var p=k;export{p as default};
@@ -3,6 +3,8 @@ import { Textarea } from '@donotdev/components';
3
3
  export interface TextAreaComponentProps extends Omit<ComponentProps<typeof Textarea>, 'value' | 'onChange'> {
4
4
  /** Field label */
5
5
  label: string;
6
+ /** Help text (entity field `hint`): an (i) after the label shows it */
7
+ info?: string;
6
8
  /** Current value */
7
9
  value?: string;
8
10
  /** Change handler */
@@ -1 +1 @@
1
- {"version":3,"file":"TextAreaComponent.d.ts","sourceRoot":"","sources":["../../../../src/components/form/fields/TextAreaComponent.tsx"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,WAAW,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAExE,OAAO,EACL,QAAQ,EAKT,MAAM,sBAAsB,CAAC;AAE9B,MAAM,WAAW,sBAAuB,SAAQ,IAAI,CAClD,cAAc,CAAC,OAAO,QAAQ,CAAC,EAC/B,OAAO,GAAG,UAAU,CACrB;IACC,kBAAkB;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,oBAAoB;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,qBAAqB;IACrB,QAAQ,EAAE,CAAC,KAAK,EAAE,WAAW,CAAC,mBAAmB,CAAC,KAAK,IAAI,CAAC;IAC5D,oBAAoB;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,6BAA6B;IAC7B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,kCAAkC;IAClC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,oBAAoB;IACpB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,8BAA8B;IAC9B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,2BAA2B;IAC3B,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,mCAAmC;IACnC,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,+BAA+B;IAC/B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,qBAAqB;IACrB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,QAAA,MAAM,iBAAiB,EAAE,aAAa,CAAC,sBAAsB,CA8I5D,CAAC;AAEF,eAAe,iBAAiB,CAAC"}
1
+ {"version":3,"file":"TextAreaComponent.d.ts","sourceRoot":"","sources":["../../../../src/components/form/fields/TextAreaComponent.tsx"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,WAAW,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAExE,OAAO,EACL,QAAQ,EAKT,MAAM,sBAAsB,CAAC;AAE9B,MAAM,WAAW,sBAAuB,SAAQ,IAAI,CAClD,cAAc,CAAC,OAAO,QAAQ,CAAC,EAC/B,OAAO,GAAG,UAAU,CACrB;IACC,kBAAkB;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,uEAAuE;IACvE,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,oBAAoB;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,qBAAqB;IACrB,QAAQ,EAAE,CAAC,KAAK,EAAE,WAAW,CAAC,mBAAmB,CAAC,KAAK,IAAI,CAAC;IAC5D,oBAAoB;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,6BAA6B;IAC7B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,kCAAkC;IAClC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,oBAAoB;IACpB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,8BAA8B;IAC9B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,2BAA2B;IAC3B,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,mCAAmC;IACnC,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,+BAA+B;IAC/B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,qBAAqB;IACrB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,QAAA,MAAM,iBAAiB,EAAE,aAAa,CAAC,sBAAsB,CAgJ5D,CAAC;AAEF,eAAe,iBAAiB,CAAC"}
@@ -1 +1 @@
1
- "use client";import{jsx as t,jsxs as l}from"react/jsx-runtime";import{useState as L,useId as N,useRef as F,useEffect as j}from"react";import{Textarea as q,FloatingLabel as A,Spinner as k,cn as m,Stack as p}from"@donotdev/components";const B=({label:x,value:o="",onChange:b,error:h,helperText:s,rows:y=3,loading:n=!1,maxLength:r,showCharCount:v=!1,autoResize:i=!1,required:z=!1,disabled:g=!1,className:$,...w})=>{const e=N(),[I,f]=L(!1),d=F(null),a=!!h,c=o.length,S=r&&c>r*.8,C=r&&c>r;return j(()=>{if(i&&d.current){const u=d.current;u.style.height="auto",u.style.height=`${u.scrollHeight}px`}},[o,i]),l(p,{gap:"tight",children:[t(A,{htmlFor:e,label:x,disabled:g||n,required:z,children:l("div",{className:"dndev-relative",children:[t(q,{ref:d,id:e,value:o,onChange:b,onFocus:()=>f(!0),onBlur:()=>f(!1),disabled:g||n,maxLength:r,rows:i?1:y,bare:!0,"aria-describedby":m(a&&`${e}-error`,s&&!a&&`${e}-helper`,v&&`${e}-count`),"aria-invalid":a,className:m("dndev-w-full",i&&"dndev-overflow-hidden",$),"data-variant":a?"destructive":void 0,style:{resize:i?"none":void 0},...w}),n&&t("div",{className:"dndev-absolute",style:{right:"var(--gap-md)",top:"var(--gap-md)"},children:t(k,{"aria-label":"Loading"})})]})}),v&&r&&l("div",{id:`${e}-count`,style:{fontSize:"var(--font-size-xs)",textAlign:"right",color:C?"var(--destructive-foreground)":S?"var(--warning)":"var(--muted-foreground)"},children:[c,"/",r]}),a&&l(p,{as:"p",id:`${e}-error`,direction:"row",align:"center",gap:"tight",style:{fontSize:"var(--font-size-xs)",color:"var(--destructive-foreground)"},role:"alert",children:[t("span",{children:"\u26A0"}),h]}),s&&!a&&t("p",{id:`${e}-helper`,style:{fontSize:"var(--font-size-xs)",color:"var(--muted-foreground)"},children:s})]})};var E=B;export{E as default};
1
+ "use client";import{jsx as t,jsxs as o}from"react/jsx-runtime";import{useState as N,useId as F,useRef as j,useEffect as q}from"react";import{Textarea as A,FloatingLabel as R,Spinner as k,cn as m,Stack as p}from"@donotdev/components";const B=({label:x,info:b,value:s="",onChange:y,error:h,helperText:n,rows:z=3,loading:d=!1,maxLength:r,showCharCount:v=!1,autoResize:i=!1,required:w=!1,disabled:g=!1,className:$,...S})=>{const e=F(),[I,f]=N(!1),l=j(null),a=!!h,c=s.length,C=r&&c>r*.8,L=r&&c>r;return q(()=>{if(i&&l.current){const u=l.current;u.style.height="auto",u.style.height=`${u.scrollHeight}px`}},[s,i]),o(p,{gap:"tight",children:[t(R,{htmlFor:e,label:x,info:b,disabled:g||d,required:w,children:o("div",{className:"dndev-relative",children:[t(A,{ref:l,id:e,value:s,onChange:y,onFocus:()=>f(!0),onBlur:()=>f(!1),disabled:g||d,maxLength:r,rows:i?1:z,bare:!0,"aria-describedby":m(a&&`${e}-error`,n&&!a&&`${e}-helper`,v&&`${e}-count`),"aria-invalid":a,className:m("dndev-w-full",i&&"dndev-overflow-hidden",$),"data-variant":a?"destructive":void 0,style:{resize:i?"none":void 0},...S}),d&&t("div",{className:"dndev-absolute",style:{right:"var(--gap-md)",top:"var(--gap-md)"},children:t(k,{"aria-label":"Loading"})})]})}),v&&r&&o("div",{id:`${e}-count`,style:{fontSize:"var(--font-size-xs)",textAlign:"right",color:L?"var(--destructive-foreground)":C?"var(--warning)":"var(--muted-foreground)"},children:[c,"/",r]}),a&&o(p,{as:"p",id:`${e}-error`,direction:"row",align:"center",gap:"tight",style:{fontSize:"var(--font-size-xs)",color:"var(--destructive-foreground)"},role:"alert",children:[t("span",{children:"\u26A0"}),h]}),n&&!a&&t("p",{id:`${e}-helper`,style:{fontSize:"var(--font-size-xs)",color:"var(--muted-foreground)"},children:n})]})};var E=B;export{E as default};
@@ -3,6 +3,8 @@ import { Input } from '@donotdev/components';
3
3
  export interface TextFieldComponentProps extends Omit<ComponentProps<typeof Input>, 'value' | 'onChange'> {
4
4
  /** Field label */
5
5
  label: string;
6
+ /** Help text (entity field `hint`): an (i) after the label shows it */
7
+ info?: string;
6
8
  /** Current value */
7
9
  value?: string;
8
10
  /** Change handler */
@@ -46,6 +48,6 @@ export interface TextFieldComponentProps extends Omit<ComponentProps<typeof Inpu
46
48
  * @param props - TextFieldComponentProps
47
49
  * @returns JSX.Element
48
50
  */
49
- declare function TextFieldComponent({ label, value, onChange, error, helperText, type, loading, maxLength, showCharCount, required, disabled, className, ref, ...props }: TextFieldComponentProps): import("react").JSX.Element;
51
+ declare function TextFieldComponent({ label, info, value, onChange, error, helperText, type, loading, maxLength, showCharCount, required, disabled, className, ref, ...props }: TextFieldComponentProps): import("react").JSX.Element;
50
52
  export default TextFieldComponent;
51
53
  //# sourceMappingURL=TextFieldComponent.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"TextFieldComponent.d.ts","sourceRoot":"","sources":["../../../../src/components/form/fields/TextFieldComponent.tsx"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAEzD,OAAO,EAAE,KAAK,EAA6B,MAAM,sBAAsB,CAAC;AAExE,MAAM,WAAW,uBAAwB,SAAQ,IAAI,CACnD,cAAc,CAAC,OAAO,KAAK,CAAC,EAC5B,OAAO,GAAG,UAAU,CACrB;IACC,kBAAkB;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,oBAAoB;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,qBAAqB;IACrB,QAAQ,EAAE,CACR,KAAK,EAAE,WAAW,CAAC,gBAAgB,GAAG,mBAAmB,CAAC,KACvD,IAAI,CAAC;IACV,oBAAoB;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,6BAA6B;IAC7B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,iCAAiC;IACjC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,oBAAoB;IACpB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,8BAA8B;IAC9B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,2BAA2B;IAC3B,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,+BAA+B;IAC/B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,qBAAqB;IACrB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,iBAAS,kBAAkB,CAAC,EAC1B,KAAK,EACL,KAAU,EACV,QAAQ,EACR,KAAK,EACL,UAAU,EACV,IAAa,EACb,OAAe,EACf,SAAS,EACT,aAAqB,EACrB,QAAgB,EAChB,QAAgB,EAChB,SAAS,EACT,GAAG,EACH,GAAG,KAAK,EACT,EAAE,uBAAuB,+BAwFzB;AAED,eAAe,kBAAkB,CAAC"}
1
+ {"version":3,"file":"TextFieldComponent.d.ts","sourceRoot":"","sources":["../../../../src/components/form/fields/TextFieldComponent.tsx"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAEzD,OAAO,EAAE,KAAK,EAA6B,MAAM,sBAAsB,CAAC;AAExE,MAAM,WAAW,uBAAwB,SAAQ,IAAI,CACnD,cAAc,CAAC,OAAO,KAAK,CAAC,EAC5B,OAAO,GAAG,UAAU,CACrB;IACC,kBAAkB;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,uEAAuE;IACvE,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,oBAAoB;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,qBAAqB;IACrB,QAAQ,EAAE,CACR,KAAK,EAAE,WAAW,CAAC,gBAAgB,GAAG,mBAAmB,CAAC,KACvD,IAAI,CAAC;IACV,oBAAoB;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,6BAA6B;IAC7B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,iCAAiC;IACjC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,oBAAoB;IACpB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,8BAA8B;IAC9B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,2BAA2B;IAC3B,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,+BAA+B;IAC/B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,qBAAqB;IACrB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,iBAAS,kBAAkB,CAAC,EAC1B,KAAK,EACL,IAAI,EACJ,KAAU,EACV,QAAQ,EACR,KAAK,EACL,UAAU,EACV,IAAa,EACb,OAAe,EACf,SAAS,EACT,aAAqB,EACrB,QAAgB,EAChB,QAAgB,EAChB,SAAS,EACT,GAAG,EACH,GAAG,KAAK,EACT,EAAE,uBAAuB,+BAyFzB;AAED,eAAe,kBAAkB,CAAC"}
@@ -1 +1 @@
1
- "use client";import{jsx as n,jsxs as o}from"react/jsx-runtime";import{useId as C}from"react";import{Input as S,cn as c,Stack as u}from"@donotdev/components";function j({label:h,value:d="",onChange:v,error:l,helperText:a,type:f="text",loading:g=!1,maxLength:e,showCharCount:s=!1,required:p=!1,disabled:m=!1,className:x,ref:b,...y}){const r=C(),t=!!l,i=d.length,z=e&&i>e*.8,$=e&&i>e,{children:A,...w}=y;return o(u,{gap:"tight",children:[n(S,{ref:b,id:r,type:f,value:d,onChange:v,label:h,disabled:m||g,maxLength:e,required:p,"aria-describedby":c(t&&`${r}-error`,a&&!t&&`${r}-helper`,s&&`${r}-count`),"aria-invalid":t,className:c("dndev-w-full",x),"data-variant":t?"destructive":void 0,...w}),s&&e&&o("div",{id:`${r}-count`,style:{fontSize:"var(--font-size-xs)",textAlign:"right",color:$?"var(--destructive-foreground)":z?"var(--warning)":"var(--muted-foreground)"},children:[i,"/",e]}),t&&o(u,{id:`${r}-error`,direction:"row",align:"center",gap:"tight",style:{fontSize:"var(--font-size-xs)",color:"var(--destructive-foreground)"},role:"alert",children:[n("span",{children:"\u26A0"}),l]}),a&&!t&&n("p",{id:`${r}-helper`,style:{fontSize:"var(--font-size-xs)",color:"var(--muted-foreground)"},children:a})]})}var q=j;export{q as default};
1
+ "use client";import{jsx as o,jsxs as i}from"react/jsx-runtime";import{useId as S}from"react";import{Input as j,cn as c,Stack as u}from"@donotdev/components";function q({label:f,info:h,value:d="",onChange:v,error:l,helperText:a,type:g="text",loading:p=!1,maxLength:e,showCharCount:s=!1,required:m=!1,disabled:x=!1,className:z,ref:b,...y}){const r=S(),t=!!l,n=d.length,$=e&&n>e*.8,w=e&&n>e,{children:I,...C}=y;return i(u,{gap:"tight",children:[o(j,{ref:b,id:r,type:g,value:d,onChange:v,label:f,info:h,disabled:x||p,maxLength:e,required:m,"aria-describedby":c(t&&`${r}-error`,a&&!t&&`${r}-helper`,s&&`${r}-count`),"aria-invalid":t,className:c("dndev-w-full",z),"data-variant":t?"destructive":void 0,...C}),s&&e&&i("div",{id:`${r}-count`,style:{fontSize:"var(--font-size-xs)",textAlign:"right",color:w?"var(--destructive-foreground)":$?"var(--warning)":"var(--muted-foreground)"},children:[n,"/",e]}),t&&i(u,{id:`${r}-error`,direction:"row",align:"center",gap:"tight",style:{fontSize:"var(--font-size-xs)",color:"var(--destructive-foreground)"},role:"alert",children:[o("span",{children:"\u26A0"}),l]}),a&&!t&&o("p",{id:`${r}-helper`,style:{fontSize:"var(--font-size-xs)",color:"var(--muted-foreground)"},children:a})]})}var A=q;export{A as default};
@@ -10,6 +10,8 @@ import type { ChangeEvent, ComponentType } from 'react';
10
10
  export interface TimestampFieldComponentProps {
11
11
  /** Field label */
12
12
  label: string;
13
+ /** Help text (entity field `hint`): an (i) after the label shows it */
14
+ info?: string;
13
15
  /** Current Date value or null */
14
16
  value?: Date | null;
15
17
  /** Change handler - accepts both event and direct value */
@@ -1 +1 @@
1
- {"version":3,"file":"TimestampFieldComponent.d.ts","sourceRoot":"","sources":["../../../../src/components/form/fields/TimestampFieldComponent.tsx"],"names":[],"mappings":"AAEA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAIxD,MAAM,WAAW,4BAA4B;IAC3C,kBAAkB;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,iCAAiC;IACjC,KAAK,CAAC,EAAE,IAAI,GAAG,IAAI,CAAC;IACpB,2DAA2D;IAC3D,QAAQ,EAAE,CAAC,IAAI,EAAE,IAAI,GAAG,IAAI,GAAG,WAAW,CAAC,gBAAgB,CAAC,KAAK,IAAI,CAAC;IACtE,oBAAoB;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,kBAAkB;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,oEAAoE;IACpE,IAAI,CAAC,EAAE,gBAAgB,GAAG,MAAM,CAAC;IACjC,oCAAoC;IACpC,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,QAAA,MAAM,uBAAuB,EAAE,aAAa,CAAC,4BAA4B,CAuCxE,CAAC;AAEF,eAAe,uBAAuB,CAAC"}
1
+ {"version":3,"file":"TimestampFieldComponent.d.ts","sourceRoot":"","sources":["../../../../src/components/form/fields/TimestampFieldComponent.tsx"],"names":[],"mappings":"AAEA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAIxD,MAAM,WAAW,4BAA4B;IAC3C,kBAAkB;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,uEAAuE;IACvE,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,iCAAiC;IACjC,KAAK,CAAC,EAAE,IAAI,GAAG,IAAI,CAAC;IACpB,2DAA2D;IAC3D,QAAQ,EAAE,CAAC,IAAI,EAAE,IAAI,GAAG,IAAI,GAAG,WAAW,CAAC,gBAAgB,CAAC,KAAK,IAAI,CAAC;IACtE,oBAAoB;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,kBAAkB;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,oEAAoE;IACpE,IAAI,CAAC,EAAE,gBAAgB,GAAG,MAAM,CAAC;IACjC,oCAAoC;IACpC,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,QAAA,MAAM,uBAAuB,EAAE,aAAa,CAAC,4BAA4B,CAyCxE,CAAC;AAEF,eAAe,uBAAuB,CAAC"}
@@ -1 +1 @@
1
- import{jsx as u}from"react/jsx-runtime";import d from"./DateFieldComponent";const g=({label:a,value:e,onChange:r,error:o,helperText:l,mode:n="datetime-local",required:i})=>{const m=e?new Date(e).toISOString():"";return u(d,{label:a,value:m,onChange:t=>{if(t){const s={target:{value:new Date(t).toISOString()}};r(s)}else r({target:{value:""}})},error:o,helperText:l,mode:n,required:i})};var p=g;export{p as default};
1
+ import{jsx as d}from"react/jsx-runtime";import f from"./DateFieldComponent";const g=({label:o,info:a,value:e,onChange:r,error:l,helperText:n,mode:i="datetime-local",required:m})=>{const s=e?new Date(e).toISOString():"";return d(f,{label:o,info:a,value:s,onChange:t=>{if(t){const u={target:{value:new Date(t).toISOString()}};r(u)}else r({target:{value:""}})},error:l,helperText:n,mode:i,required:m})};var p=g;export{p as default};
@@ -0,0 +1,24 @@
1
+ /**
2
+ * @fileoverview Inline field row
3
+ * @description Row for `[control] label` fields (switch, checkbox, consent) in CRUD forms.
4
+ *
5
+ * @version 0.1.0
6
+ * @since 0.2.3
7
+ * @author AMBROISE PARK Consulting
8
+ */
9
+ import type { ReactElement, ReactNode } from 'react';
10
+ /** Props for {@link InlineFieldRow}. */
11
+ export interface InlineFieldRowProps {
12
+ /** The control and its label */
13
+ children: ReactNode;
14
+ }
15
+ /**
16
+ * Row for inline-control form fields. Matches the height of label-on-top inputs and
17
+ * centres the control vertically, so switch/checkbox rows align with inputs in one-
18
+ * and multi-column form grids.
19
+ *
20
+ * @param props - InlineFieldRowProps
21
+ * @returns The row
22
+ */
23
+ export declare function InlineFieldRow({ children }: InlineFieldRowProps): ReactElement;
24
+ //# sourceMappingURL=InlineFieldRow.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"InlineFieldRow.d.ts","sourceRoot":"","sources":["../../../../../src/components/form/fields/internal/InlineFieldRow.tsx"],"names":[],"mappings":"AAEA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAiB,YAAY,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAOpE,wCAAwC;AACxC,MAAM,WAAW,mBAAmB;IAClC,gCAAgC;IAChC,QAAQ,EAAE,SAAS,CAAC;CACrB;AAED;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAAC,EAAE,QAAQ,EAAE,EAAE,mBAAmB,GAAG,YAAY,CAM9E"}
@@ -0,0 +1 @@
1
+ import{jsx as i}from"react/jsx-runtime";import{Stack as r}from"@donotdev/components";const e={minBlockSize:"var(--touch-target)"};function o({children:t}){return i(r,{direction:"row",align:"center",gap:"tight",style:e,children:t})}export{o as InlineFieldRow};
@@ -1 +1 @@
1
- {"version":3,"file":"TiptapEditor.d.ts","sourceRoot":"","sources":["../../../../../src/components/form/fields/internal/TiptapEditor.tsx"],"names":[],"mappings":"AAmBA,OAAO,KAAK,EAAe,aAAa,EAAE,MAAM,OAAO,CAAC;AAIxD,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,UAAU,CAAC;AA0KvD;;;;;;;;;GASG;AACH,QAAA,MAAM,YAAY,EAAE,aAAa,CAAC,sBAAsB,CAuDvD,CAAC;AAEF,eAAe,YAAY,CAAC"}
1
+ {"version":3,"file":"TiptapEditor.d.ts","sourceRoot":"","sources":["../../../../../src/components/form/fields/internal/TiptapEditor.tsx"],"names":[],"mappings":"AAmBA,OAAO,KAAK,EAAe,aAAa,EAAE,MAAM,OAAO,CAAC;AAIxD,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,UAAU,CAAC;AA+KvD;;;;;;;;;GASG;AACH,QAAA,MAAM,YAAY,EAAE,aAAa,CAAC,sBAAsB,CAuDvD,CAAC;AAEF,eAAe,YAAY,CAAC"}
@@ -1,4 +1,4 @@
1
- "use client";import{jsx as i,jsxs as m}from"react/jsx-runtime";import{useEffect as u,useState as f}from"react";import{Stack as P}from"@donotdev/components";const x=({label:d,value:r="",onChange:s,error:e,helperText:n,required:o,disabled:a,placeholder:l,className:c,modules:g})=>{const{useEditor:v,EditorContent:p,StarterKit:h,Placeholder:b}=g,t=v({extensions:[h.configure({heading:{levels:[1,2,3]}}),b.configure({placeholder:l||"Start typing..."})],content:r,editable:!a,onUpdate:({editor:y})=>{const M={target:{value:y.getHTML()}};s(M)}});return u(()=>{t&&r!==t.getHTML()&&t.commands.setContent(r||"")},[r,t]),t?m(P,{gap:"tight",children:[m("label",{style:{fontSize:"var(--font-size-sm)",fontWeight:500,color:e?"var(--destructive-foreground)":"var(--foreground)"},children:[d,o&&i("span",{style:{color:"var(--destructive)"},children:" *"})]}),i("div",{className:c,"data-variant":e?"destructive":void 0,style:{border:"var(--border-hairline) solid",borderColor:e?"var(--destructive)":"var(--line-2)",borderRadius:"var(--radius-interactive)",padding:"var(--gap-md)",minHeight:"200px",backgroundColor:a?"var(--muted)":"transparent",opacity:a?"var(--opacity-muted)":void 0},children:i(p,{editor:t})}),n&&i("p",{style:{fontSize:"var(--font-size-xs)",color:e?"var(--destructive-foreground)":"var(--muted-foreground)"},children:n}),i("style",{children:`
1
+ "use client";import{jsx as i,jsxs as m}from"react/jsx-runtime";import{useEffect as u,useState as f}from"react";import{Stack as M}from"@donotdev/components";const x=({label:s,value:r="",onChange:d,error:e,helperText:n,required:o,disabled:a,placeholder:l,className:c,modules:g})=>{const{useEditor:v,EditorContent:p,StarterKit:h,Placeholder:b}=g,t=v({extensions:[h.configure({heading:{levels:[1,2,3]}}),b.configure({placeholder:l||"Start typing..."})],content:r,editable:!a,onUpdate:({editor:P})=>{const y={target:{value:P.getHTML()}};d(y)}});return u(()=>{t&&r!==t.getHTML()&&t.commands.setContent(r||"")},[r,t]),t?m(M,{gap:"tight",children:[m("label",{style:{fontSize:"var(--font-size-sm)",fontWeight:500,color:e?"var(--destructive-foreground)":"var(--foreground)"},children:[s,o&&i("span",{style:{color:"var(--destructive)"},children:" *"})]}),i("div",{className:c,"data-variant":e?"destructive":void 0,style:{border:"var(--border-hairline) solid",borderColor:e?"var(--destructive)":"var(--line-2)",borderRadius:"var(--radius-interactive)",padding:"var(--gap-md)",minHeight:"200px",backgroundColor:a?"var(--muted)":"transparent",opacity:a?"var(--opacity-muted)":void 0},children:i(p,{editor:t})}),n&&i("p",{style:{fontSize:"var(--font-size-xs)",color:e?"var(--destructive-foreground)":"var(--muted-foreground)"},children:n}),i("style",{children:`
2
2
  .ProseMirror {
3
3
  outline: none;
4
4
  min-height: 150px;
@@ -49,4 +49,4 @@
49
49
  margin: 0.5em 0;
50
50
  color: var(--muted-foreground);
51
51
  }
52
- `})]}):null},z=d=>{const[r,s]=f(null),[e,n]=f(!1);return u(()=>{r||e||(async()=>{try{const[{useEditor:o,EditorContent:a},l,c]=await Promise.all([import("@tiptap/react"),import("@tiptap/starter-kit"),import("@tiptap/extension-placeholder")]);s({useEditor:o,EditorContent:a,StarterKit:l.default,Placeholder:c.default})}catch(o){o instanceof Error&&(o.message.includes("Cannot find module '@tiptap")||o.message.includes("Failed to fetch dynamically imported module")),n(!0)}})()},[r,e]),e||!r?null:i(x,{...d,modules:r})};var C=z;export{C as default};
52
+ `})]}):null},z=s=>{const[r,d]=f(null),[e,n]=f(!1);return u(()=>{r||e||(async()=>{try{const[{useEditor:o,EditorContent:a},l,c]=await Promise.all([import("@tiptap/react"),import("@tiptap/starter-kit"),import("@tiptap/extension-placeholder")]);d({useEditor:o,EditorContent:a,StarterKit:l.default,Placeholder:c.default})}catch(o){o instanceof Error&&(o.message.includes("Cannot find module '@tiptap")||o.message.includes("Failed to fetch dynamically imported module")),n(!0)}})()},[r,e]),e||!r?null:i(x,{...s,modules:r})};var C=z;export{C as default};
@@ -1 +1 @@
1
- "use client";import{jsx as e,Fragment as re,jsxs as a}from"react/jsx-runtime";import{ChevronLeft as le,ChevronRight as ne,RotateCcw as M,RotateCw as B,Trash2 as de,Check as ce,Undo2 as se,ZoomIn as ge,ZoomOut as me,Maximize2 as pe,Grid3X3 as he}from"lucide-react";import{useCallback as g,useEffect as H,useState as c,useRef as ue}from"react";import ve from"react-easy-crop";import{Button as o,BUTTON_VARIANT as r,Sheet as fe,Stack as n,Text as u,Slider as F,ToggleGroup as ye}from"@donotdev/components";import{useTranslation as we}from"@donotdev/core";import{processImage as Ce}from"../../../utils/imageProcessing";import{createPreviewURL as be,revokePreviewURL as ke}from"../../../utils/imageUtils";const xe={free:void 0,"1:1":1,"4:3":4/3,"16:9":16/9,"3:2":3/2};function Y({images:h,selectedIndex:l,open:R,onClose:T,onUpdate:D,onDelete:E,onNavigate:m,multiple:L=!1}){const{t}=we("crud"),[Z,C]=c({x:0,y:0}),[v,p]=c(1),[b,f]=c(0),[N,$]=c(null),[S,z]=c("free"),[k,q]=c(!0),[y,w]=c(!1),[A,G]=c(!1),[X,x]=c(!1),I=ue({crop:{x:0,y:0},zoom:1,rotation:0}),d=h[l],U=L&&l>0,O=L&&l<h.length-1;H(()=>{if(d){const i={x:0,y:0};C(i),p(1),f(d.rotation*90),z("free"),w(!1),x(!1),I.current={crop:i,zoom:1,rotation:d.rotation*90}}},[d]);const _=g((i,s)=>{$(s)},[]),J=g(()=>{C(I.current.crop),p(I.current.zoom),f(I.current.rotation)},[]),P=g(()=>{f(i=>(i-90+360)%360)},[]),V=g(()=>{f(i=>(i+90)%360)},[]),K=g(()=>{p(i=>Math.min(i+.25,3))},[]),Q=g(()=>{p(i=>Math.max(i-.25,1))},[]),ee=g(()=>{p(1),C({x:0,y:0})},[]),ie=async()=>{if(!(!d||!N)){G(!0);try{const i=await Ce(d.file,{crop:N,maxWidth:2048,maxHeight:2048,quality:.95}),s=new File([i.fullBlob],d.file.name,{type:"image/webp"}),oe=be(s);d.previewURL.startsWith("blob:")&&ke(d.previewURL),D(l,{file:s,previewURL:oe,uploaded:null,uploadProgress:null,error:null,rotation:0}),w(!1)}catch{}finally{G(!1)}}},te=g(()=>{E(l),x(!1),h.length===1?T():l>=h.length-1&&m(l-1)},[l,h.length,E,T,m]);if(H(()=>{if(!R)return;const i=s=>{s.key==="ArrowLeft"&&U?m(l-1):s.key==="ArrowRight"&&O?m(l+1):s.key==="Escape"&&y&&w(!1)};return window.addEventListener("keydown",i),()=>window.removeEventListener("keydown",i)},[R,U,O,l,m,y]),!d)return null;const W=d.uploadProgress!==null&&d.uploadProgress<100,j=d.uploaded?.fullUrl||d.previewURL,ae=L?t("image.editor.titleWithIndex",{current:l+1,total:h.length}):t("image.editor.title");return e(fe,{open:R,onOpenChange:i=>!i&&T(),side:"right",title:ae,description:t("image.editor.description"),noSwipe:y,children:a(n,{gap:"large",style:{height:"100%"},children:[e("div",{style:{position:"relative",flex:1,minHeight:300,backgroundColor:"var(--surface-muted)",borderRadius:"var(--radius-lg)",overflow:"hidden"},children:y?e(ve,{image:j,crop:Z,zoom:v,rotation:b,aspect:xe[S],onCropChange:C,onCropComplete:_,onZoomChange:p,showGrid:k,style:{containerStyle:{position:"absolute",top:0,left:0,right:0,bottom:0},cropAreaStyle:{border:"2px solid var(--primary)",boxShadow:"0 0 0 9999px rgba(0,0,0,0.5)"}}}):a(re,{children:[U&&e(o,{variant:r.GHOST,icon:le,onClick:()=>m(l-1),"aria-label":t("image.editor.previousImage"),style:{position:"absolute",left:"var(--gap-sm)",top:"50%",transform:"translateY(-50%)",zIndex:10,backgroundColor:"rgba(0,0,0,0.3)",color:"white"}}),e("img",{src:j,alt:`Image ${l+1}`,style:{width:"100%",height:"100%",objectFit:"contain",transform:`rotate(${b}deg)`,transition:"transform var(--dur-normal) var(--ease-out)"}}),O&&e(o,{variant:r.GHOST,icon:ne,onClick:()=>m(l+1),"aria-label":t("image.editor.nextImage"),style:{position:"absolute",right:"var(--gap-sm)",top:"50%",transform:"translateY(-50%)",zIndex:10,backgroundColor:"rgba(0,0,0,0.3)",color:"white"}})]})}),y?a(n,{children:[a(n,{gap:"tight",children:[e(u,{level:"small",variant:"muted",children:t("image.editor.aspectRatio")}),e(ye,{type:"single",value:S,onValueChange:i=>i&&z(i),items:[{value:"free",label:t("image.editor.aspectFree")},{value:"1:1",label:"1:1"},{value:"4:3",label:"4:3"},{value:"16:9",label:"16:9"}]})]}),a(n,{gap:"tight",children:[a(n,{direction:"row",justify:"between",align:"center",children:[e(u,{level:"small",variant:"muted",children:t("image.editor.zoom")}),a(u,{level:"small",variant:"muted",children:[Math.round(v*100),"%"]})]}),a(n,{direction:"row",gap:"tight",align:"center",children:[e(o,{variant:r.OUTLINE,icon:me,display:"compact",onClick:Q,disabled:v<=1}),e(F,{value:[v],min:1,max:3,step:.05,onValueChange:i=>p(i[0]??1),style:{flex:1}}),e(o,{variant:r.OUTLINE,icon:ge,display:"compact",onClick:K,disabled:v>=3})]})]}),a(n,{gap:"tight",children:[a(n,{direction:"row",justify:"between",align:"center",children:[e(u,{level:"small",variant:"muted",children:t("image.editor.rotation")}),a(u,{level:"small",variant:"muted",children:[b,"\xB0"]})]}),a(n,{direction:"row",gap:"tight",align:"center",children:[e(o,{variant:r.OUTLINE,icon:M,display:"compact",onClick:P,tooltip:t("image.editor.rotateLeft")}),e(F,{value:[b],min:0,max:360,step:1,onValueChange:i=>f(i[0]??0),style:{flex:1}}),e(o,{variant:r.OUTLINE,icon:B,display:"compact",onClick:V,tooltip:t("image.editor.rotateRight")})]})]}),a(n,{direction:"row",gap:"tight",children:[e(o,{variant:r.OUTLINE,icon:pe,display:"compact",onClick:ee,tooltip:t("image.editor.fitToView")}),e(o,{variant:r.OUTLINE,icon:he,display:"compact",onClick:()=>q(!k),tooltip:t(k?"image.editor.hideGrid":"image.editor.showGrid"),"data-active":k||void 0}),e(o,{variant:r.OUTLINE,icon:se,display:"compact",onClick:J,tooltip:t("image.editor.reset")})]}),a(n,{direction:"row",style:{marginTop:"var(--gap-md)"},children:[e(o,{variant:r.OUTLINE,onClick:()=>w(!1),fullWidth:!0,children:t("image.editor.cancel")}),e(o,{variant:r.PRIMARY,icon:ce,onClick:ie,disabled:A,fullWidth:!0,children:t(A?"image.editor.processing":"image.editor.apply")})]})]}):a(n,{children:[a(n,{direction:"row",gap:"tight",justify:"center",children:[e(o,{variant:r.OUTLINE,icon:M,display:"compact",onClick:P,tooltip:t("image.editor.rotateLeft")}),e(o,{variant:r.PRIMARY,onClick:()=>w(!0),disabled:W,children:t("image.editor.editButton")}),e(o,{variant:r.OUTLINE,icon:B,display:"compact",onClick:V,tooltip:t("image.editor.rotateRight")})]}),X?a(n,{style:{border:"1px solid var(--destructive)",padding:"var(--gap-md)",borderRadius:"var(--radius-md)"},children:[e(u,{variant:"destructive",level:"small",textAlign:"center",children:t("image.editor.deleteConfirm")}),a(n,{direction:"row",gap:"tight",children:[e(o,{variant:r.OUTLINE,onClick:()=>x(!1),fullWidth:!0,children:t("image.editor.cancel")}),e(o,{variant:r.DESTRUCTIVE,onClick:te,fullWidth:!0,children:t("actions.delete")})]})]}):e(o,{variant:r.GHOST,icon:de,onClick:()=>x(!0),disabled:W,style:{color:"var(--destructive)"},children:t("image.editor.deleteImage")})]})]})})}var Ie=Y;export{Y as ImageViewerDialog,Ie as default};
1
+ "use client";import{jsx as e,Fragment as re,jsxs as a}from"react/jsx-runtime";import{ChevronLeft as ne,ChevronRight as le,RotateCcw as M,RotateCw as B,Trash2 as de,Check as ce,Undo2 as se,ZoomIn as ge,ZoomOut as me,Maximize2 as pe,Grid3X3 as he}from"lucide-react";import{useCallback as g,useEffect as H,useState as c,useRef as ue}from"react";import ve from"react-easy-crop";import{Button as o,BUTTON_VARIANT as r,Sheet as fe,Stack as l,Text as u,Slider as F,ToggleGroup as ye}from"@donotdev/components";import{useTranslation as we}from"@donotdev/core";import{processImage as Ce}from"../../../utils/imageProcessing";import{createPreviewURL as be,revokePreviewURL as ke}from"../../../utils/imageUtils";const xe={free:void 0,"1:1":1,"4:3":4/3,"16:9":16/9,"3:2":3/2};function Y({images:h,selectedIndex:n,open:T,onClose:U,onUpdate:Z,onDelete:E,onNavigate:m,multiple:L=!1}){const{t}=we("crud"),[D,C]=c({x:0,y:0}),[v,p]=c(1),[b,f]=c(0),[N,$]=c(null),[S,z]=c("free"),[k,q]=c(!0),[y,w]=c(!1),[A,G]=c(!1),[X,x]=c(!1),I=ue({crop:{x:0,y:0},zoom:1,rotation:0}),d=h[n],R=L&&n>0,O=L&&n<h.length-1;H(()=>{if(d){const i={x:0,y:0};C(i),p(1),f(d.rotation*90),z("free"),w(!1),x(!1),I.current={crop:i,zoom:1,rotation:d.rotation*90}}},[d]);const _=g((i,s)=>{$(s)},[]),J=g(()=>{C(I.current.crop),p(I.current.zoom),f(I.current.rotation)},[]),P=g(()=>{f(i=>(i-90+360)%360)},[]),V=g(()=>{f(i=>(i+90)%360)},[]),K=g(()=>{p(i=>Math.min(i+.25,3))},[]),Q=g(()=>{p(i=>Math.max(i-.25,1))},[]),ee=g(()=>{p(1),C({x:0,y:0})},[]),ie=async()=>{if(!(!d||!N)){G(!0);try{const i=await Ce(d.file,{crop:N,maxWidth:2048,maxHeight:2048,quality:.95}),s=new File([i.fullBlob],d.file.name,{type:"image/webp"}),oe=be(s);d.previewURL.startsWith("blob:")&&ke(d.previewURL),Z(n,{file:s,previewURL:oe,uploaded:null,uploadProgress:null,error:null,rotation:0}),w(!1)}catch{}finally{G(!1)}}},te=g(()=>{E(n),x(!1),h.length===1?U():n>=h.length-1&&m(n-1)},[n,h.length,E,U,m]);if(H(()=>{if(!T)return;const i=s=>{s.key==="ArrowLeft"&&R?m(n-1):s.key==="ArrowRight"&&O?m(n+1):s.key==="Escape"&&y&&w(!1)};return window.addEventListener("keydown",i),()=>window.removeEventListener("keydown",i)},[T,R,O,n,m,y]),!d)return null;const W=d.uploadProgress!==null&&d.uploadProgress<100,j=d.uploaded?.fullUrl||d.previewURL,ae=L?t("image.editor.titleWithIndex",{current:n+1,total:h.length}):t("image.editor.title");return e(fe,{open:T,onOpenChange:i=>!i&&U(),side:"right",title:ae,description:t("image.editor.description"),noSwipe:y,children:a(l,{gap:"large",style:{height:"100%"},children:[e("div",{style:{position:"relative",flex:1,minHeight:300,backgroundColor:"var(--surface-muted)",borderRadius:"var(--radius-lg)",overflow:"hidden"},children:y?e(ve,{image:j,crop:D,zoom:v,rotation:b,aspect:xe[S],onCropChange:C,onCropComplete:_,onZoomChange:p,showGrid:k,style:{containerStyle:{position:"absolute",top:0,left:0,right:0,bottom:0},cropAreaStyle:{border:"2px solid var(--primary)",boxShadow:"0 0 0 9999px rgba(0,0,0,0.5)"}}}):a(re,{children:[R&&e(o,{variant:r.GHOST,icon:ne,onClick:()=>m(n-1),"aria-label":t("image.editor.previousImage"),style:{position:"absolute",left:"var(--gap-sm)",top:"50%",transform:"translateY(-50%)",zIndex:10,backgroundColor:"rgba(0,0,0,0.3)",color:"white"}}),e("img",{src:j,alt:`Image ${n+1}`,style:{width:"100%",height:"100%",objectFit:"contain",transform:`rotate(${b}deg)`,transition:"transform var(--dur-normal) var(--ease-out)"}}),O&&e(o,{variant:r.GHOST,icon:le,onClick:()=>m(n+1),"aria-label":t("image.editor.nextImage"),style:{position:"absolute",right:"var(--gap-sm)",top:"50%",transform:"translateY(-50%)",zIndex:10,backgroundColor:"rgba(0,0,0,0.3)",color:"white"}})]})}),y?a(l,{children:[a(l,{gap:"tight",children:[e(u,{level:"small",variant:"muted",children:t("image.editor.aspectRatio")}),e(ye,{type:"single",value:S,onValueChange:i=>i&&z(i),items:[{value:"free",label:t("image.editor.aspectFree")},{value:"1:1",label:"1:1"},{value:"4:3",label:"4:3"},{value:"16:9",label:"16:9"}]})]}),a(l,{gap:"tight",children:[a(l,{direction:"row",justify:"between",align:"center",children:[e(u,{level:"small",variant:"muted",children:t("image.editor.zoom")}),a(u,{level:"small",variant:"muted",children:[Math.round(v*100),"%"]})]}),a(l,{direction:"row",gap:"tight",align:"center",children:[e(o,{variant:r.OUTLINE,icon:me,display:"compact",onClick:Q,disabled:v<=1}),e(F,{value:[v],min:1,max:3,step:.05,onValueChange:i=>p(i[0]??1),style:{flex:1}}),e(o,{variant:r.OUTLINE,icon:ge,display:"compact",onClick:K,disabled:v>=3})]})]}),a(l,{gap:"tight",children:[a(l,{direction:"row",justify:"between",align:"center",children:[e(u,{level:"small",variant:"muted",children:t("image.editor.rotation")}),a(u,{level:"small",variant:"muted",children:[b,"\xB0"]})]}),a(l,{direction:"row",gap:"tight",align:"center",children:[e(o,{variant:r.OUTLINE,icon:M,display:"compact",onClick:P,tooltip:t("image.editor.rotateLeft")}),e(F,{value:[b],min:0,max:360,step:1,onValueChange:i=>f(i[0]??0),style:{flex:1}}),e(o,{variant:r.OUTLINE,icon:B,display:"compact",onClick:V,tooltip:t("image.editor.rotateRight")})]})]}),a(l,{direction:"row",gap:"tight",children:[e(o,{variant:r.OUTLINE,icon:pe,display:"compact",onClick:ee,tooltip:t("image.editor.fitToView")}),e(o,{variant:r.OUTLINE,icon:he,display:"compact",onClick:()=>q(!k),tooltip:t(k?"image.editor.hideGrid":"image.editor.showGrid"),"data-active":k||void 0}),e(o,{variant:r.OUTLINE,icon:se,display:"compact",onClick:J,tooltip:t("image.editor.reset")})]}),a(l,{direction:"row",style:{marginTop:"var(--gap-md)"},children:[e(o,{variant:r.OUTLINE,onClick:()=>w(!1),fullWidth:!0,children:t("image.editor.cancel")}),e(o,{variant:r.PRIMARY,icon:ce,onClick:ie,disabled:A,fullWidth:!0,children:t(A?"image.editor.processing":"image.editor.apply")})]})]}):a(l,{children:[a(l,{direction:"row",gap:"tight",justify:"center",children:[e(o,{variant:r.OUTLINE,icon:M,display:"compact",onClick:P,tooltip:t("image.editor.rotateLeft")}),e(o,{variant:r.PRIMARY,onClick:()=>w(!0),disabled:W,children:t("image.editor.editButton")}),e(o,{variant:r.OUTLINE,icon:B,display:"compact",onClick:V,tooltip:t("image.editor.rotateRight")})]}),X?a(l,{style:{border:"1px solid var(--destructive)",padding:"var(--gap-md)",borderRadius:"var(--radius-md)"},children:[e(u,{variant:"destructive",level:"small",textAlign:"center",children:t("image.editor.deleteConfirm")}),a(l,{direction:"row",gap:"tight",children:[e(o,{variant:r.OUTLINE,onClick:()=>x(!1),fullWidth:!0,children:t("image.editor.cancel")}),e(o,{variant:r.DESTRUCTIVE,onClick:te,fullWidth:!0,children:t("actions.delete")})]})]}):e(o,{variant:r.GHOST,icon:de,onClick:()=>x(!0),disabled:W,style:{color:"var(--destructive)"},children:t("image.editor.deleteImage")})]})]})})}var Ie=Y;export{Y as ImageViewerDialog,Ie as default};
@@ -22,4 +22,6 @@ export type { YearFilterValue, YearFilterProps } from './YearFilter';
22
22
  export * from './fields/display';
23
23
  export { DisplayThumbnail } from './DisplayThumbnail';
24
24
  export { CrudCard } from './CrudCard';
25
+ export { SortableCardList } from './SortableCardList';
26
+ export type { SortableCardListProps } from './SortableCardList';
25
27
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AAEA;;;;;;;GAOG;AAEH,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,cAAc,CAAC;AACrD,YAAY,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AACpD,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,oBAAoB,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAC3E,YAAY,EAAE,yBAAyB,EAAE,MAAM,wBAAwB,CAAC;AACxE,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,cAAc,CAAC;AACrD,cAAc,cAAc,CAAC;AAC7B,cAAc,QAAQ,CAAC;AACvB,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,YAAY,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAC1D,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,YAAY,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AACrE,cAAc,kBAAkB,CAAC;AACjC,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AAEA;;;;;;;GAOG;AAEH,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,cAAc,CAAC;AACrD,YAAY,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AACpD,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,oBAAoB,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAC3E,YAAY,EAAE,yBAAyB,EAAE,MAAM,wBAAwB,CAAC;AACxE,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,cAAc,CAAC;AACrD,cAAc,cAAc,CAAC;AAC7B,cAAc,QAAQ,CAAC;AACvB,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,YAAY,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAC1D,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,YAAY,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AACrE,cAAc,kBAAkB,CAAC;AACjC,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,YAAY,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC"}
@@ -1 +1 @@
1
- import{default as r}from"./CrudButton";import{FormFieldRenderer as a}from"./FormFieldRenderer";import{DisplayFieldRenderer as e,formatValue as o}from"./DisplayFieldRenderer";import{default as t}from"./FormLayout";export*from"./controlled";export*from"./form";import{EntityFilters as m}from"./EntityFilters";import{matchesFilter as s}from"../utils/matchesFilter";import{YearFilter as i}from"./YearFilter";export*from"./fields/display";import{DisplayThumbnail as l}from"./DisplayThumbnail";import{CrudCard as p}from"./CrudCard";export{r as CrudButton,p as CrudCard,e as DisplayFieldRenderer,l as DisplayThumbnail,m as EntityFilters,a as FormFieldRenderer,t as FormLayout,i as YearFilter,o as formatValue,s as matchesFilter};
1
+ import{default as r}from"./CrudButton";import{FormFieldRenderer as a}from"./FormFieldRenderer";import{DisplayFieldRenderer as t,formatValue as e}from"./DisplayFieldRenderer";import{default as o}from"./FormLayout";export*from"./controlled";export*from"./form";import{EntityFilters as m}from"./EntityFilters";import{matchesFilter as s}from"../utils/matchesFilter";import{YearFilter as i}from"./YearFilter";export*from"./fields/display";import{DisplayThumbnail as l}from"./DisplayThumbnail";import{CrudCard as p}from"./CrudCard";import{SortableCardList as d}from"./SortableCardList";export{r as CrudButton,p as CrudCard,t as DisplayFieldRenderer,l as DisplayThumbnail,m as EntityFilters,a as FormFieldRenderer,o as FormLayout,d as SortableCardList,i as YearFilter,e as formatValue,s as matchesFilter};
@@ -1,6 +1,6 @@
1
1
  import type { FieldTypeMetadata } from './fieldTypeRegistry.types';
2
- export type { FilterType, ValueType, DisplayFormatterOptions, DisplayFormatter, ComponentRegistration, FieldTypeMetadata, } from './fieldTypeRegistry.types';
3
- export { getFieldTypeMetadata, getFilterType, getDisplayFormatter, isFilterable, getValueType, clearFieldTypeRegistry, } from './fieldTypeRegistry.store';
2
+ export type { FilterType, DisplayFormatterOptions, DisplayFormatter, ComponentRegistration, FieldTypeMetadata, } from './fieldTypeRegistry.types';
3
+ export { getFieldTypeMetadata, getFilterType, getDisplayFormatter, isFilterable, clearFieldTypeRegistry, } from './fieldTypeRegistry.store';
4
4
  /**
5
5
  * Register a built-in field type with all metadata.
6
6
  * For internal/plugin use — consumers should use registerFieldType() instead.
@@ -1 +1 @@
1
- {"version":3,"file":"fieldTypeRegistry.d.ts","sourceRoot":"","sources":["../src/fieldTypeRegistry.ts"],"names":[],"mappings":"AAuBA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAUnE,YAAY,EACV,UAAU,EACV,SAAS,EACT,uBAAuB,EACvB,gBAAgB,EAChB,qBAAqB,EACrB,iBAAiB,GAClB,MAAM,2BAA2B,CAAC;AAInC,OAAO,EACL,oBAAoB,EACpB,aAAa,EACb,mBAAmB,EACnB,YAAY,EACZ,YAAY,EACZ,sBAAsB,GACvB,MAAM,2BAA2B,CAAC;AAInC;;;GAGG;AACH,wBAAgB,wBAAwB,CAAC,QAAQ,EAAE,iBAAiB,GAAG,IAAI,CAa1E"}
1
+ {"version":3,"file":"fieldTypeRegistry.d.ts","sourceRoot":"","sources":["../src/fieldTypeRegistry.ts"],"names":[],"mappings":"AAuBA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAUnE,YAAY,EACV,UAAU,EACV,uBAAuB,EACvB,gBAAgB,EAChB,qBAAqB,EACrB,iBAAiB,GAClB,MAAM,2BAA2B,CAAC;AAInC,OAAO,EACL,oBAAoB,EACpB,aAAa,EACb,mBAAmB,EACnB,YAAY,EACZ,sBAAsB,GACvB,MAAM,2BAA2B,CAAC;AAInC;;;GAGG;AACH,wBAAgB,wBAAwB,CAAC,QAAQ,EAAE,iBAAiB,GAAG,IAAI,CAa1E"}
@@ -1 +1 @@
1
- "use client";import{getFieldRegistry as i}from"./FieldRegistry";import{setRegistrationInit as s,getMetadataRegistry as r}from"./fieldTypeRegistry.store";import{registerAllBuiltinFieldTypes as l}from"./registerBuiltinFieldTypes";s(e=>{l(e,i())});import{getFieldTypeMetadata as o,getFilterType as p,getDisplayFormatter as g,isFilterable as y,getValueType as n,clearFieldTypeRegistry as F}from"./fieldTypeRegistry.store";function d(e){const{type:a,components:t}=e;t&&i().registerComponent(a,t.controlled,t.uncontrolled),r().set(a,e)}export{F as clearFieldTypeRegistry,g as getDisplayFormatter,o as getFieldTypeMetadata,p as getFilterType,n as getValueType,y as isFilterable,d as registerBuiltinFieldType};
1
+ "use client";import{getFieldRegistry as a}from"./FieldRegistry";import{setRegistrationInit as s,getMetadataRegistry as r}from"./fieldTypeRegistry.store";import{registerAllBuiltinFieldTypes as l}from"./registerBuiltinFieldTypes";s(e=>{l(e,a())});import{getFieldTypeMetadata as o,getFilterType as p,getDisplayFormatter as g,isFilterable as n,clearFieldTypeRegistry as y}from"./fieldTypeRegistry.store";function F(e){const{type:i,components:t}=e;t&&a().registerComponent(i,t.controlled,t.uncontrolled),r().set(i,e)}export{y as clearFieldTypeRegistry,g as getDisplayFormatter,o as getFieldTypeMetadata,p as getFilterType,n as isFilterable,F as registerBuiltinFieldType};
@@ -1,7 +1,6 @@
1
1
  import type { FieldTypeMetadata } from './fieldTypeRegistry.types';
2
2
  import type { DisplayFormatter } from './fieldTypeRegistry.types';
3
3
  import type { FilterType } from './fieldTypeRegistry.types';
4
- import type { ValueType } from './fieldTypeRegistry.types';
5
4
  /**
6
5
  * Called once by fieldTypeRegistry.ts to wire the lazy init callback.
7
6
  * Keeps this file free of imports from registerBuiltinFieldTypes.
@@ -12,6 +11,5 @@ export declare function getFieldTypeMetadata(type: string): FieldTypeMetadata |
12
11
  export declare function getFilterType(type: string): FilterType | undefined;
13
12
  export declare function getDisplayFormatter(type: string): DisplayFormatter | undefined;
14
13
  export declare function isFilterable(type: string): boolean;
15
- export declare function getValueType(type: string): ValueType | undefined;
16
14
  export declare function clearFieldTypeRegistry(): void;
17
15
  //# sourceMappingURL=fieldTypeRegistry.store.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"fieldTypeRegistry.store.d.ts","sourceRoot":"","sources":["../src/fieldTypeRegistry.store.ts"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AACnE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAClE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAC5D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AAiB3D;;;GAGG;AACH,wBAAgB,mBAAmB,CACjC,EAAE,EAAE,CAAC,QAAQ,EAAE,GAAG,CAAC,MAAM,EAAE,iBAAiB,CAAC,KAAK,IAAI,GACrD,IAAI,CAEN;AAED,wBAAgB,mBAAmB,IAAI,GAAG,CAAC,MAAM,EAAE,iBAAiB,CAAC,CAOpE;AAID,wBAAgB,oBAAoB,CAClC,IAAI,EAAE,MAAM,GACX,iBAAiB,GAAG,SAAS,CAE/B;AAED,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,UAAU,GAAG,SAAS,CAIlE;AAED,wBAAgB,mBAAmB,CACjC,IAAI,EAAE,MAAM,GACX,gBAAgB,GAAG,SAAS,CAI9B;AAED,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAGlD;AAED,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,GAAG,SAAS,CAEhE;AAED,wBAAgB,sBAAsB,IAAI,IAAI,CAE7C"}
1
+ {"version":3,"file":"fieldTypeRegistry.store.d.ts","sourceRoot":"","sources":["../src/fieldTypeRegistry.store.ts"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AACnE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAClE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAiB5D;;;GAGG;AACH,wBAAgB,mBAAmB,CACjC,EAAE,EAAE,CAAC,QAAQ,EAAE,GAAG,CAAC,MAAM,EAAE,iBAAiB,CAAC,KAAK,IAAI,GACrD,IAAI,CAEN;AAED,wBAAgB,mBAAmB,IAAI,GAAG,CAAC,MAAM,EAAE,iBAAiB,CAAC,CAOpE;AAID,wBAAgB,oBAAoB,CAClC,IAAI,EAAE,MAAM,GACX,iBAAiB,GAAG,SAAS,CAE/B;AAED,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,UAAU,GAAG,SAAS,CAIlE;AAED,wBAAgB,mBAAmB,CACjC,IAAI,EAAE,MAAM,GACX,gBAAgB,GAAG,SAAS,CAI9B;AAED,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAGlD;AAED,wBAAgB,sBAAsB,IAAI,IAAI,CAE7C"}
@@ -1 +1 @@
1
- "use client";import{getGlobalSingleton as n}from"@donotdev/core";import{getFieldRegistry as i}from"./FieldRegistry";function r(){return n("field-type-metadata",()=>({registry:new Map,builtinsRegistered:!1,initFn:null}))}function a(e){r().initFn=e}function t(){const e=r();return e.builtinsRegistered||(e.builtinsRegistered=!0,e.initFn?.(e.registry)),e.registry}function s(e){return t().get(e)}function l(e){return i().getFilterType(e)||t().get(e)?.filterType}function g(e){return i().getDisplayFormatter(e)||t().get(e)?.displayFormatter}function u(e){return i().isFilterable(e)?!0:t().get(e)?.filterable??!1}function o(e){return t().get(e)?.valueType}function y(){t().clear()}export{y as clearFieldTypeRegistry,g as getDisplayFormatter,s as getFieldTypeMetadata,l as getFilterType,t as getMetadataRegistry,o as getValueType,u as isFilterable,a as setRegistrationInit};
1
+ "use client";import{getGlobalSingleton as n}from"@donotdev/core";import{getFieldRegistry as i}from"./FieldRegistry";function r(){return n("field-type-metadata",()=>({registry:new Map,builtinsRegistered:!1,initFn:null}))}function a(e){r().initFn=e}function t(){const e=r();return e.builtinsRegistered||(e.builtinsRegistered=!0,e.initFn?.(e.registry)),e.registry}function s(e){return t().get(e)}function l(e){return i().getFilterType(e)||t().get(e)?.filterType}function g(e){return i().getDisplayFormatter(e)||t().get(e)?.displayFormatter}function o(e){return i().isFilterable(e)?!0:t().get(e)?.filterable??!1}function u(){t().clear()}export{u as clearFieldTypeRegistry,g as getDisplayFormatter,s as getFieldTypeMetadata,l as getFilterType,t as getMetadataRegistry,o as isFilterable,a as setRegistrationInit};
@@ -6,13 +6,14 @@ import type { ComponentType, ReactElement } from 'react';
6
6
  import type { EntityField, FieldType } from '@donotdev/core';
7
7
  import type { ControlledFieldProps, UncontrolledFieldProps } from './FieldRegistry';
8
8
  /**
9
- * Filter type metadata for EntityFilters component
9
+ * Filter type metadata for EntityFilters component. Matching (`matchesFilter`):
10
+ * - `text`, `address`: case-insensitive substring
11
+ * - `select`, `multiselect`, `reference`: exact value; an array value matches when any
12
+ * of its items is selected (any-of); `reference` options are the referenced
13
+ * documents' labels, matched by id
14
+ * - `range`: min/max; `rating`: minimum
10
15
  */
11
- export type FilterType = 'text' | 'range' | 'select' | 'none' | 'address' | 'multiselect' | 'rating';
12
- /**
13
- * Value type for type checking
14
- */
15
- export type ValueType = 'string' | 'number' | 'boolean' | 'date' | 'object' | 'array';
16
+ export type FilterType = 'text' | 'range' | 'select' | 'none' | 'address' | 'multiselect' | 'rating' | 'reference';
16
17
  /**
17
18
  * Display formatter function
18
19
  */
@@ -37,7 +38,7 @@ export interface ComponentRegistration {
37
38
  /**
38
39
  * Complete metadata for a built-in field type
39
40
  *
40
- * NOTE: Schemas are registered separately in @donotdev/core/schemas/getSchemaType.ts
41
+ * NOTE: Values (schema + storage kind) live in BUILTIN_VALUES (@donotdev/core, core/schemas/src/common/fieldSemantics.ts)
41
42
  * This registry only handles UI components + filter/display metadata
42
43
  */
43
44
  export interface FieldTypeMetadata {
@@ -49,8 +50,6 @@ export interface FieldTypeMetadata {
49
50
  filterType?: FilterType;
50
51
  /** Display formatter function */
51
52
  displayFormatter?: DisplayFormatter;
52
- /** Runtime value type */
53
- valueType?: ValueType;
54
53
  /** UI components */
55
54
  components?: ComponentRegistration;
56
55
  }
@@ -1 +1 @@
1
- {"version":3,"file":"fieldTypeRegistry.types.d.ts","sourceRoot":"","sources":["../src/fieldTypeRegistry.types.ts"],"names":[],"mappings":"AAGA;;;GAGG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAEzD,OAAO,KAAK,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAE7D,OAAO,KAAK,EACV,oBAAoB,EACpB,sBAAsB,EACvB,MAAM,iBAAiB,CAAC;AAEzB;;GAEG;AACH,MAAM,MAAM,UAAU,GAClB,MAAM,GACN,OAAO,GACP,QAAQ,GACR,MAAM,GACN,SAAS,GACT,aAAa,GACb,QAAQ,CAAC;AAEb;;GAEG;AACH,MAAM,MAAM,SAAS,GACjB,QAAQ,GACR,QAAQ,GACR,SAAS,GACT,MAAM,GACN,QAAQ,GACR,OAAO,CAAC;AAEZ;;GAEG;AACH,MAAM,MAAM,uBAAuB,GAAG;IACpC,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,4EAA4E;IAC5E,aAAa,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IACvD,4GAA4G;IAC5G,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,6FAA6F;IAC7F,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAChC,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG,CAC7B,KAAK,EAAE,GAAG,EACV,MAAM,EAAE,WAAW,EACnB,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,KAAK,MAAM,EACzD,OAAO,CAAC,EAAE,uBAAuB,KAC9B,MAAM,GAAG,YAAY,CAAC;AAE3B;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC,UAAU,EAAE,aAAa,CAAC,oBAAoB,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC;IAC1D,YAAY,CAAC,EAAE,aAAa,CAAC,sBAAsB,CAAC,CAAC;CACtD;AAED;;;;;GAKG;AACH,MAAM,WAAW,iBAAiB;IAChC,4BAA4B;IAC5B,IAAI,EAAE,SAAS,CAAC;IAChB,4CAA4C;IAC5C,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,uCAAuC;IACvC,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB,iCAAiC;IACjC,gBAAgB,CAAC,EAAE,gBAAgB,CAAC;IACpC,yBAAyB;IACzB,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,oBAAoB;IACpB,UAAU,CAAC,EAAE,qBAAqB,CAAC;CACpC"}
1
+ {"version":3,"file":"fieldTypeRegistry.types.d.ts","sourceRoot":"","sources":["../src/fieldTypeRegistry.types.ts"],"names":[],"mappings":"AAGA;;;GAGG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAEzD,OAAO,KAAK,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAE7D,OAAO,KAAK,EACV,oBAAoB,EACpB,sBAAsB,EACvB,MAAM,iBAAiB,CAAC;AAEzB;;;;;;;GAOG;AACH,MAAM,MAAM,UAAU,GAClB,MAAM,GACN,OAAO,GACP,QAAQ,GACR,MAAM,GACN,SAAS,GACT,aAAa,GACb,QAAQ,GACR,WAAW,CAAC;AAEhB;;GAEG;AACH,MAAM,MAAM,uBAAuB,GAAG;IACpC,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,4EAA4E;IAC5E,aAAa,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IACvD,4GAA4G;IAC5G,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,6FAA6F;IAC7F,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAChC,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG,CAE7B,KAAK,EAAE,GAAG,EACV,MAAM,EAAE,WAAW,EAEnB,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,KAAK,MAAM,EACzD,OAAO,CAAC,EAAE,uBAAuB,KAC9B,MAAM,GAAG,YAAY,CAAC;AAE3B;;GAEG;AACH,MAAM,WAAW,qBAAqB;IAEpC,UAAU,EAAE,aAAa,CAAC,oBAAoB,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC;IAC1D,YAAY,CAAC,EAAE,aAAa,CAAC,sBAAsB,CAAC,CAAC;CACtD;AAED;;;;;GAKG;AACH,MAAM,WAAW,iBAAiB;IAChC,4BAA4B;IAC5B,IAAI,EAAE,SAAS,CAAC;IAChB,4CAA4C;IAC5C,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,uCAAuC;IACvC,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB,iCAAiC;IACjC,gBAAgB,CAAC,EAAE,gBAAgB,CAAC;IACpC,oBAAoB;IACpB,UAAU,CAAC,EAAE,qBAAqB,CAAC;CACpC"}
@@ -0,0 +1,24 @@
1
+ /** Router access a form needs to leave on save and return on failure. */
2
+ export interface FormNavigation {
3
+ /** Navigate to an app path. */
4
+ navigate: (path: string) => void;
5
+ /** Current app path, read at call time. */
6
+ currentPath: () => string;
7
+ /** Previous breadcrumb of the current path (nearest existing parent route, else home). */
8
+ parentPath: () => string;
9
+ }
10
+ /**
11
+ * Provides router access to every `useEntityForm` below it.
12
+ * `@donotdev/ui` mounts it in `UIProviders`; apps do not mount it themselves.
13
+ *
14
+ * @example
15
+ * ```tsx
16
+ * <FormNavigationProvider value={{ navigate, currentPath, parentPath }}>
17
+ * {children}
18
+ * </FormNavigationProvider>
19
+ * ```
20
+ */
21
+ export declare const FormNavigationProvider: import("react").Provider<FormNavigation | null>;
22
+ /** Router access for forms, or null when no router provided it. */
23
+ export declare function useFormNavigation(): FormNavigation | null;
24
+ //# sourceMappingURL=FormNavigation.d.ts.map