@open-mercato/core 0.5.1-develop.2953.6647bb2c43 → 0.5.1-develop.2964.d5ac4a6ebb

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 (226) hide show
  1. package/dist/helpers/integration/salesUi.js +25 -23
  2. package/dist/helpers/integration/salesUi.js.map +2 -2
  3. package/dist/modules/api_docs/frontend/docs/api/Explorer.js +24 -24
  4. package/dist/modules/api_docs/frontend/docs/api/Explorer.js.map +2 -2
  5. package/dist/modules/attachments/components/AttachmentPartitionSettings.js +15 -7
  6. package/dist/modules/attachments/components/AttachmentPartitionSettings.js.map +2 -2
  7. package/dist/modules/attachments/fields/attachment.js +4 -6
  8. package/dist/modules/attachments/fields/attachment.js.map +2 -2
  9. package/dist/modules/auth/backend/users/create/page.js +26 -26
  10. package/dist/modules/auth/backend/users/create/page.js.map +2 -2
  11. package/dist/modules/business_rules/components/ActionRow.js +36 -25
  12. package/dist/modules/business_rules/components/ActionRow.js.map +2 -2
  13. package/dist/modules/business_rules/components/ConditionGroup.js +14 -5
  14. package/dist/modules/business_rules/components/ConditionGroup.js.map +2 -2
  15. package/dist/modules/business_rules/components/ConditionRow.js +19 -10
  16. package/dist/modules/business_rules/components/ConditionRow.js.map +2 -2
  17. package/dist/modules/business_rules/components/RuleSetMembers.js +16 -10
  18. package/dist/modules/business_rules/components/RuleSetMembers.js.map +2 -2
  19. package/dist/modules/catalog/backend/catalog/products/[id]/page.js +30 -34
  20. package/dist/modules/catalog/backend/catalog/products/[id]/page.js.map +2 -2
  21. package/dist/modules/catalog/backend/catalog/products/create/page.js +220 -223
  22. package/dist/modules/catalog/backend/catalog/products/create/page.js.map +2 -2
  23. package/dist/modules/catalog/components/PriceKindSettings.js +20 -19
  24. package/dist/modules/catalog/components/PriceKindSettings.js.map +2 -2
  25. package/dist/modules/catalog/components/products/ProductUomSection.js +42 -37
  26. package/dist/modules/catalog/components/products/ProductUomSection.js.map +2 -2
  27. package/dist/modules/catalog/components/products/VariantBuilder.js +22 -18
  28. package/dist/modules/catalog/components/products/VariantBuilder.js.map +2 -2
  29. package/dist/modules/customer_accounts/backend/customer_accounts/users/[id]/page.js +18 -26
  30. package/dist/modules/customer_accounts/backend/customer_accounts/users/[id]/page.js.map +2 -2
  31. package/dist/modules/customer_accounts/backend/customer_accounts/users/page.js +4 -6
  32. package/dist/modules/customer_accounts/backend/customer_accounts/users/page.js.map +2 -2
  33. package/dist/modules/customer_accounts/widgets/injection/account-status/widget.client.js +5 -4
  34. package/dist/modules/customer_accounts/widgets/injection/account-status/widget.client.js.map +2 -2
  35. package/dist/modules/customers/backend/config/customers/pipeline-stages/page.js +19 -7
  36. package/dist/modules/customers/backend/config/customers/pipeline-stages/page.js.map +2 -2
  37. package/dist/modules/customers/backend/customers/deals/pipeline/page.js +24 -21
  38. package/dist/modules/customers/backend/customers/deals/pipeline/page.js.map +2 -2
  39. package/dist/modules/customers/components/AddressEditor.js +24 -7
  40. package/dist/modules/customers/components/AddressEditor.js.map +2 -2
  41. package/dist/modules/customers/components/AddressFormatSettings.js +35 -25
  42. package/dist/modules/customers/components/AddressFormatSettings.js.map +2 -2
  43. package/dist/modules/customers/components/detail/ActivityForm.js +20 -12
  44. package/dist/modules/customers/components/detail/ActivityForm.js.map +2 -2
  45. package/dist/modules/customers/components/detail/AnnualRevenueField.js +2 -2
  46. package/dist/modules/customers/components/detail/AnnualRevenueField.js.map +2 -2
  47. package/dist/modules/customers/components/detail/DealForm.js +19 -14
  48. package/dist/modules/customers/components/detail/DealForm.js.map +2 -2
  49. package/dist/modules/customers/components/formConfig.js +16 -12
  50. package/dist/modules/customers/components/formConfig.js.map +2 -2
  51. package/dist/modules/customers/widgets/dashboard/customer-todos/widget.client.js +3 -2
  52. package/dist/modules/customers/widgets/dashboard/customer-todos/widget.client.js.map +2 -2
  53. package/dist/modules/customers/widgets/dashboard/new-customers/widget.client.js +18 -10
  54. package/dist/modules/customers/widgets/dashboard/new-customers/widget.client.js.map +2 -2
  55. package/dist/modules/customers/widgets/dashboard/new-deals/widget.client.js +3 -2
  56. package/dist/modules/customers/widgets/dashboard/new-deals/widget.client.js.map +2 -2
  57. package/dist/modules/customers/widgets/dashboard/next-interactions/widget.client.js +3 -2
  58. package/dist/modules/customers/widgets/dashboard/next-interactions/widget.client.js.map +2 -2
  59. package/dist/modules/dashboards/components/WidgetVisibilityEditor.js +27 -28
  60. package/dist/modules/dashboards/components/WidgetVisibilityEditor.js.map +2 -2
  61. package/dist/modules/dashboards/widgets/dashboard/orders-by-status/widget.client.js +14 -6
  62. package/dist/modules/dashboards/widgets/dashboard/orders-by-status/widget.client.js.map +2 -2
  63. package/dist/modules/dashboards/widgets/dashboard/revenue-trend/widget.client.js +14 -6
  64. package/dist/modules/dashboards/widgets/dashboard/revenue-trend/widget.client.js.map +2 -2
  65. package/dist/modules/dashboards/widgets/dashboard/sales-by-region/widget.client.js +3 -2
  66. package/dist/modules/dashboards/widgets/dashboard/sales-by-region/widget.client.js.map +2 -2
  67. package/dist/modules/dashboards/widgets/dashboard/top-customers/widget.client.js +3 -2
  68. package/dist/modules/dashboards/widgets/dashboard/top-customers/widget.client.js.map +2 -2
  69. package/dist/modules/dashboards/widgets/dashboard/top-products/widget.client.js +17 -8
  70. package/dist/modules/dashboards/widgets/dashboard/top-products/widget.client.js.map +2 -2
  71. package/dist/modules/data_sync/backend/data-sync/page.js +40 -23
  72. package/dist/modules/data_sync/backend/data-sync/page.js.map +2 -2
  73. package/dist/modules/data_sync/components/IntegrationScheduleTab.js +15 -6
  74. package/dist/modules/data_sync/components/IntegrationScheduleTab.js.map +2 -2
  75. package/dist/modules/dictionaries/components/AppearanceSelector.js +4 -4
  76. package/dist/modules/dictionaries/components/AppearanceSelector.js.map +2 -2
  77. package/dist/modules/dictionaries/components/DictionaryEntriesEditor.js +4 -5
  78. package/dist/modules/dictionaries/components/DictionaryEntriesEditor.js.map +2 -2
  79. package/dist/modules/dictionaries/components/DictionaryEntrySelect.js +22 -14
  80. package/dist/modules/dictionaries/components/DictionaryEntrySelect.js.map +2 -2
  81. package/dist/modules/dictionaries/fields/dictionary.js +18 -13
  82. package/dist/modules/dictionaries/fields/dictionary.js.map +2 -2
  83. package/dist/modules/entities/components/EncryptionManager.js +23 -19
  84. package/dist/modules/entities/components/EncryptionManager.js.map +2 -2
  85. package/dist/modules/feature_toggles/components/formConfig.js +17 -9
  86. package/dist/modules/feature_toggles/components/formConfig.js.map +2 -2
  87. package/dist/modules/feature_toggles/components/overrideFormConfig.js +17 -9
  88. package/dist/modules/feature_toggles/components/overrideFormConfig.js.map +2 -2
  89. package/dist/modules/inbox_ops/backend/inbox-ops/settings/page.js +15 -8
  90. package/dist/modules/inbox_ops/backend/inbox-ops/settings/page.js.map +2 -2
  91. package/dist/modules/inbox_ops/components/proposals/EditActionDialog.js +37 -22
  92. package/dist/modules/inbox_ops/components/proposals/EditActionDialog.js.map +2 -2
  93. package/dist/modules/integrations/backend/integrations/[id]/page.js +22 -17
  94. package/dist/modules/integrations/backend/integrations/[id]/page.js.map +2 -2
  95. package/dist/modules/integrations/backend/integrations/bundle/[id]/page.js +12 -6
  96. package/dist/modules/integrations/backend/integrations/bundle/[id]/page.js.map +2 -2
  97. package/dist/modules/planner/components/AvailabilityRulesEditor.js +19 -12
  98. package/dist/modules/planner/components/AvailabilityRulesEditor.js.map +2 -2
  99. package/dist/modules/resources/components/ResourceCrudForm.js +15 -10
  100. package/dist/modules/resources/components/ResourceCrudForm.js.map +3 -3
  101. package/dist/modules/sales/backend/sales/documents/[id]/page.js +15 -18
  102. package/dist/modules/sales/backend/sales/documents/[id]/page.js.map +2 -2
  103. package/dist/modules/sales/components/ProviderFieldInput.js +23 -20
  104. package/dist/modules/sales/components/ProviderFieldInput.js.map +2 -2
  105. package/dist/modules/sales/components/ShippingMethodsSettings.js +25 -17
  106. package/dist/modules/sales/components/ShippingMethodsSettings.js.map +3 -3
  107. package/dist/modules/sales/components/channels/ChannelOfferForm.js +35 -42
  108. package/dist/modules/sales/components/channels/ChannelOfferForm.js.map +2 -2
  109. package/dist/modules/sales/components/documents/AddressesSection.js +87 -90
  110. package/dist/modules/sales/components/documents/AddressesSection.js.map +2 -2
  111. package/dist/modules/sales/components/documents/AdjustmentDialog.js +17 -6
  112. package/dist/modules/sales/components/documents/AdjustmentDialog.js.map +3 -3
  113. package/dist/modules/sales/components/documents/LineItemDialog.js +42 -25
  114. package/dist/modules/sales/components/documents/LineItemDialog.js.map +2 -2
  115. package/dist/modules/sales/components/documents/SalesDocumentForm.js +96 -87
  116. package/dist/modules/sales/components/documents/SalesDocumentForm.js.map +2 -2
  117. package/dist/modules/sales/widgets/dashboard/new-orders/widget.client.js +20 -11
  118. package/dist/modules/sales/widgets/dashboard/new-orders/widget.client.js.map +2 -2
  119. package/dist/modules/sales/widgets/dashboard/new-quotes/widget.client.js +20 -11
  120. package/dist/modules/sales/widgets/dashboard/new-quotes/widget.client.js.map +2 -2
  121. package/dist/modules/shipping_carriers/lib/shipment-wizard/components/ConfigureStep.js +36 -22
  122. package/dist/modules/shipping_carriers/lib/shipment-wizard/components/ConfigureStep.js.map +2 -2
  123. package/dist/modules/staff/components/TeamMemberForm.js +14 -9
  124. package/dist/modules/staff/components/TeamMemberForm.js.map +3 -3
  125. package/dist/modules/workflows/backend/tasks/[id]/page.js +42 -21
  126. package/dist/modules/workflows/backend/tasks/[id]/page.js.map +2 -2
  127. package/dist/modules/workflows/components/ActivitiesEditor.js +14 -6
  128. package/dist/modules/workflows/components/ActivitiesEditor.js.map +3 -3
  129. package/dist/modules/workflows/components/DefinitionTriggersEditor.js +25 -17
  130. package/dist/modules/workflows/components/DefinitionTriggersEditor.js.map +3 -3
  131. package/dist/modules/workflows/components/EdgeEditDialog.js +48 -45
  132. package/dist/modules/workflows/components/EdgeEditDialog.js.map +2 -2
  133. package/dist/modules/workflows/components/NodeEditDialog.js +90 -90
  134. package/dist/modules/workflows/components/NodeEditDialog.js.map +2 -2
  135. package/dist/modules/workflows/components/StepsEditor.js +14 -6
  136. package/dist/modules/workflows/components/StepsEditor.js.map +3 -3
  137. package/dist/modules/workflows/components/TransitionsEditor.js +31 -26
  138. package/dist/modules/workflows/components/TransitionsEditor.js.map +3 -3
  139. package/dist/modules/workflows/components/fields/ActivityArrayEditor.js +19 -11
  140. package/dist/modules/workflows/components/fields/ActivityArrayEditor.js.map +3 -3
  141. package/dist/modules/workflows/components/fields/BusinessRuleConditionsEditor.js +12 -14
  142. package/dist/modules/workflows/components/fields/BusinessRuleConditionsEditor.js.map +2 -2
  143. package/dist/modules/workflows/components/fields/FormFieldArrayEditor.js +24 -16
  144. package/dist/modules/workflows/components/fields/FormFieldArrayEditor.js.map +3 -3
  145. package/dist/modules/workflows/components/fields/StartPreConditionsEditor.js +12 -13
  146. package/dist/modules/workflows/components/fields/StartPreConditionsEditor.js.map +2 -2
  147. package/dist/modules/workflows/components/mobile/MobileTaskForm.js +12 -8
  148. package/dist/modules/workflows/components/mobile/MobileTaskForm.js.map +2 -2
  149. package/dist/modules/workflows/frontend/checkout-demo/page.js +43 -46
  150. package/dist/modules/workflows/frontend/checkout-demo/page.js.map +2 -2
  151. package/package.json +3 -3
  152. package/src/helpers/integration/salesUi.ts +40 -30
  153. package/src/modules/api_docs/frontend/docs/api/Explorer.tsx +25 -19
  154. package/src/modules/attachments/components/AttachmentPartitionSettings.tsx +21 -11
  155. package/src/modules/attachments/fields/attachment.tsx +4 -6
  156. package/src/modules/auth/backend/users/create/page.tsx +16 -20
  157. package/src/modules/business_rules/components/ActionRow.tsx +51 -32
  158. package/src/modules/business_rules/components/ConditionGroup.tsx +20 -9
  159. package/src/modules/business_rules/components/ConditionRow.tsx +24 -15
  160. package/src/modules/business_rules/components/RuleSetMembers.tsx +23 -13
  161. package/src/modules/catalog/backend/catalog/products/[id]/page.tsx +47 -53
  162. package/src/modules/catalog/backend/catalog/products/create/page.tsx +84 -87
  163. package/src/modules/catalog/components/PriceKindSettings.tsx +9 -9
  164. package/src/modules/catalog/components/products/ProductUomSection.tsx +85 -83
  165. package/src/modules/catalog/components/products/VariantBuilder.tsx +49 -33
  166. package/src/modules/customer_accounts/backend/customer_accounts/users/[id]/page.tsx +12 -27
  167. package/src/modules/customer_accounts/backend/customer_accounts/users/page.tsx +4 -6
  168. package/src/modules/customer_accounts/widgets/injection/account-status/widget.client.tsx +5 -4
  169. package/src/modules/customers/backend/config/customers/pipeline-stages/page.tsx +28 -15
  170. package/src/modules/customers/backend/customers/deals/pipeline/page.tsx +37 -26
  171. package/src/modules/customers/components/AddressEditor.tsx +30 -16
  172. package/src/modules/customers/components/AddressFormatSettings.tsx +25 -19
  173. package/src/modules/customers/components/detail/ActivityForm.tsx +35 -23
  174. package/src/modules/customers/components/detail/AnnualRevenueField.tsx +2 -2
  175. package/src/modules/customers/components/detail/DealForm.tsx +33 -20
  176. package/src/modules/customers/components/formConfig.tsx +25 -17
  177. package/src/modules/customers/widgets/dashboard/customer-todos/widget.client.tsx +3 -2
  178. package/src/modules/customers/widgets/dashboard/new-customers/widget.client.tsx +21 -11
  179. package/src/modules/customers/widgets/dashboard/new-deals/widget.client.tsx +3 -2
  180. package/src/modules/customers/widgets/dashboard/next-interactions/widget.client.tsx +3 -2
  181. package/src/modules/dashboards/components/WidgetVisibilityEditor.tsx +17 -22
  182. package/src/modules/dashboards/widgets/dashboard/orders-by-status/widget.client.tsx +17 -7
  183. package/src/modules/dashboards/widgets/dashboard/revenue-trend/widget.client.tsx +20 -10
  184. package/src/modules/dashboards/widgets/dashboard/sales-by-region/widget.client.tsx +3 -2
  185. package/src/modules/dashboards/widgets/dashboard/top-customers/widget.client.tsx +3 -2
  186. package/src/modules/dashboards/widgets/dashboard/top-products/widget.client.tsx +20 -9
  187. package/src/modules/data_sync/backend/data-sync/page.tsx +64 -38
  188. package/src/modules/data_sync/components/IntegrationScheduleTab.tsx +18 -7
  189. package/src/modules/dictionaries/components/AppearanceSelector.tsx +4 -4
  190. package/src/modules/dictionaries/components/DictionaryEntriesEditor.tsx +3 -4
  191. package/src/modules/dictionaries/components/DictionaryEntrySelect.tsx +27 -21
  192. package/src/modules/dictionaries/fields/dictionary.tsx +36 -23
  193. package/src/modules/entities/components/EncryptionManager.tsx +49 -33
  194. package/src/modules/feature_toggles/components/formConfig.tsx +20 -10
  195. package/src/modules/feature_toggles/components/overrideFormConfig.tsx +20 -10
  196. package/src/modules/inbox_ops/backend/inbox-ops/settings/page.tsx +19 -10
  197. package/src/modules/inbox_ops/components/proposals/EditActionDialog.tsx +49 -26
  198. package/src/modules/integrations/backend/integrations/[id]/page.tsx +20 -11
  199. package/src/modules/integrations/backend/integrations/bundle/[id]/page.tsx +19 -9
  200. package/src/modules/planner/components/AvailabilityRulesEditor.tsx +34 -21
  201. package/src/modules/resources/components/ResourceCrudForm.tsx +24 -15
  202. package/src/modules/sales/backend/sales/documents/[id]/page.tsx +12 -15
  203. package/src/modules/sales/components/ProviderFieldInput.tsx +26 -17
  204. package/src/modules/sales/components/ShippingMethodsSettings.tsx +28 -20
  205. package/src/modules/sales/components/channels/ChannelOfferForm.tsx +51 -46
  206. package/src/modules/sales/components/documents/AddressesSection.tsx +78 -76
  207. package/src/modules/sales/components/documents/AdjustmentDialog.tsx +27 -15
  208. package/src/modules/sales/components/documents/LineItemDialog.tsx +69 -51
  209. package/src/modules/sales/components/documents/SalesDocumentForm.tsx +98 -87
  210. package/src/modules/sales/widgets/dashboard/new-orders/widget.client.tsx +23 -12
  211. package/src/modules/sales/widgets/dashboard/new-quotes/widget.client.tsx +23 -12
  212. package/src/modules/shipping_carriers/lib/shipment-wizard/components/ConfigureStep.tsx +35 -19
  213. package/src/modules/staff/components/TeamMemberForm.tsx +23 -14
  214. package/src/modules/workflows/backend/tasks/[id]/page.tsx +51 -23
  215. package/src/modules/workflows/components/ActivitiesEditor.tsx +20 -10
  216. package/src/modules/workflows/components/DefinitionTriggersEditor.tsx +28 -18
  217. package/src/modules/workflows/components/EdgeEditDialog.tsx +51 -40
  218. package/src/modules/workflows/components/NodeEditDialog.tsx +81 -77
  219. package/src/modules/workflows/components/StepsEditor.tsx +20 -10
  220. package/src/modules/workflows/components/TransitionsEditor.tsx +61 -44
  221. package/src/modules/workflows/components/fields/ActivityArrayEditor.tsx +22 -12
  222. package/src/modules/workflows/components/fields/BusinessRuleConditionsEditor.tsx +9 -13
  223. package/src/modules/workflows/components/fields/FormFieldArrayEditor.tsx +27 -17
  224. package/src/modules/workflows/components/fields/StartPreConditionsEditor.tsx +9 -12
  225. package/src/modules/workflows/components/mobile/MobileTaskForm.tsx +19 -11
  226. package/src/modules/workflows/frontend/checkout-demo/page.tsx +71 -60
@@ -7,6 +7,13 @@ import { DictionarySelectControl } from "@open-mercato/core/modules/dictionaries
7
7
  import { AppearanceSelector } from "@open-mercato/core/modules/dictionaries/components/AppearanceSelector";
8
8
  import { AttachmentsSection, TagsSection } from "@open-mercato/ui/backend/detail";
9
9
  import { Button } from "@open-mercato/ui/primitives/button";
10
+ import {
11
+ Select,
12
+ SelectContent,
13
+ SelectItem,
14
+ SelectTrigger,
15
+ SelectValue
16
+ } from "@open-mercato/ui/primitives/select";
10
17
  import { E } from "../../../generated/entities.ids.generated.js";
11
18
  import { useT } from "@open-mercato/shared/lib/i18n/context";
12
19
  import { useOrganizationScopeVersion } from "@open-mercato/shared/lib/frontend/useOrganizationScope";
@@ -100,22 +107,20 @@ function useResourcesResourceFormConfig(options = {}) {
100
107
  type: "custom",
101
108
  component: ({ value, setValue, setFormValue, disabled }) => /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
102
109
  /* @__PURE__ */ jsxs(
103
- "select",
110
+ Select,
104
111
  {
105
- className: "h-9 w-full rounded border px-2 text-sm",
106
- value: typeof value === "string" ? value : "",
107
- onChange: (event) => {
108
- const next = event.target.value || "";
109
- setValue(next);
112
+ value: typeof value === "string" && value ? value : void 0,
113
+ onValueChange: (next) => {
114
+ const value2 = next || "";
115
+ setValue(value2);
110
116
  if (setFormValue) {
111
- setFormValue("customFieldsetCode", resolveFieldsetCode(next || null));
117
+ setFormValue("customFieldsetCode", resolveFieldsetCode(value2 || null));
112
118
  }
113
119
  },
114
- "data-crud-focus-target": "",
115
120
  disabled,
116
121
  children: [
117
- /* @__PURE__ */ jsx("option", { value: "", children: t("ui.forms.select.emptyOption", "\u2014") }),
118
- resourceTypes.map((type) => /* @__PURE__ */ jsx("option", { value: type.id, children: type.name }, type.id))
122
+ /* @__PURE__ */ jsx(SelectTrigger, { "data-crud-focus-target": "", children: /* @__PURE__ */ jsx(SelectValue, { placeholder: t("ui.forms.select.emptyOption", "\u2014") }) }),
123
+ /* @__PURE__ */ jsx(SelectContent, { children: resourceTypes.map((type) => /* @__PURE__ */ jsx(SelectItem, { value: type.id, children: type.name }, type.id)) })
119
124
  ]
120
125
  }
121
126
  ),
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/modules/resources/components/ResourceCrudForm.tsx"],
4
- "sourcesContent": ["\"use client\"\n\nimport * as React from 'react'\nimport { CrudForm, type CrudField, type CrudFormGroup } from '@open-mercato/ui/backend/CrudForm'\nimport { apiCall } from '@open-mercato/ui/backend/utils/apiCall'\nimport { DictionarySelectControl } from '@open-mercato/core/modules/dictionaries/components/DictionarySelectControl'\nimport { AppearanceSelector } from '@open-mercato/core/modules/dictionaries/components/AppearanceSelector'\nimport { AttachmentsSection, TagsSection, type TagOption, type TagsSectionLabels } from '@open-mercato/ui/backend/detail'\nimport { Button } from '@open-mercato/ui/primitives/button'\nimport { E } from '#generated/entities.ids.generated'\nimport { useT } from '@open-mercato/shared/lib/i18n/context'\nimport { useOrganizationScopeVersion } from '@open-mercato/shared/lib/frontend/useOrganizationScope'\nimport { RESOURCES_CAPACITY_UNIT_DICTIONARY_KEY } from '@open-mercato/core/modules/resources/lib/capacityUnits'\nimport { RESOURCES_RESOURCE_FIELDSET_DEFAULT, resolveResourcesResourceFieldsetCode } from '@open-mercato/core/modules/resources/lib/resourceCustomFields'\nimport Link from 'next/link'\nimport { Plus, Settings } from 'lucide-react'\n\nconst DEFAULT_PAGE_SIZE = 100\n\ntype ResourceTypeRow = {\n id: string\n name: string\n}\n\ntype ResourceTypesResponse = {\n items: ResourceTypeRow[]\n}\n\ntype ResourceTagsSectionConfig = {\n title: string\n tags: TagOption[]\n onChange: (next: TagOption[]) => void\n loadOptions: (query?: string) => Promise<TagOption[]>\n createTag: (label: string) => Promise<TagOption>\n onSave: (payload: { next: TagOption[]; added: TagOption[]; removed: TagOption[] }) => Promise<void>\n labels: TagsSectionLabels\n}\n\nexport type ResourcesResourceFormConfig = {\n fields: CrudField[]\n groups: CrudFormGroup[]\n resolveFieldsetCode: (resourceTypeId?: string | null) => string\n resourceTypesLoaded: boolean\n}\n\nexport function useResourcesResourceFormConfig(options: {\n tagsSection?: ResourceTagsSectionConfig\n} = {}): ResourcesResourceFormConfig {\n const { tagsSection } = options\n const t = useT()\n const scopeVersion = useOrganizationScopeVersion()\n const [resourceTypes, setResourceTypes] = React.useState<ResourceTypeRow[]>([])\n const [resourceTypesLoaded, setResourceTypesLoaded] = React.useState(false)\n const [capacityUnitDictionaryId, setCapacityUnitDictionaryId] = React.useState<string | null>(null)\n\n React.useEffect(() => {\n let cancelled = false\n async function loadResourceTypes() {\n try {\n const params = new URLSearchParams({ page: '1', pageSize: String(DEFAULT_PAGE_SIZE) })\n const call = await apiCall<ResourceTypesResponse>(`/api/resources/resource-types?${params.toString()}`)\n if (!cancelled) {\n const items = Array.isArray(call.result?.items) ? call.result.items : []\n setResourceTypes(items)\n }\n } catch {\n if (!cancelled) setResourceTypes([])\n } finally {\n if (!cancelled) setResourceTypesLoaded(true)\n }\n }\n loadResourceTypes()\n return () => { cancelled = true }\n }, [scopeVersion])\n\n React.useEffect(() => {\n let cancelled = false\n async function loadCapacityUnitDictionary() {\n try {\n const call = await apiCall<{ items?: Array<{ id?: string; key?: string; isInherited?: boolean }> }>('/api/dictionaries')\n const items = Array.isArray(call.result?.items) ? call.result.items : []\n const matches = items.filter((item) => item?.key === RESOURCES_CAPACITY_UNIT_DICTIONARY_KEY)\n const preferred = matches.find((item) => item?.isInherited === false) ?? matches[0] ?? null\n if (!cancelled) setCapacityUnitDictionaryId(preferred?.id ?? null)\n } catch {\n if (!cancelled) setCapacityUnitDictionaryId(null)\n }\n }\n loadCapacityUnitDictionary()\n return () => { cancelled = true }\n }, [scopeVersion])\n\n const resourceFieldsetByTypeId = React.useMemo(() => {\n const map = new Map<string, string>()\n resourceTypes.forEach((type) => {\n map.set(type.id, resolveResourcesResourceFieldsetCode(type.name))\n })\n return map\n }, [resourceTypes])\n\n const resolveFieldsetCode = React.useCallback((resourceTypeId?: string | null) => {\n if (!resourceTypeId) return RESOURCES_RESOURCE_FIELDSET_DEFAULT\n return resourceFieldsetByTypeId.get(resourceTypeId) ?? RESOURCES_RESOURCE_FIELDSET_DEFAULT\n }, [resourceFieldsetByTypeId])\n\n const appearanceLabels = React.useMemo(() => ({\n colorLabel: t('resources.resources.form.appearance.colorLabel', 'Color'),\n colorHelp: t('resources.resources.form.appearance.colorHelp', 'Pick a color for this resource.'),\n colorClearLabel: t('resources.resources.form.appearance.colorClear', 'Clear color'),\n iconLabel: t('resources.resources.form.appearance.iconLabel', 'Icon'),\n iconPlaceholder: t('resources.resources.form.appearance.iconPlaceholder', 'Type an emoji or icon name'),\n iconPickerTriggerLabel: t('resources.resources.form.appearance.iconPicker', 'Browse icons'),\n iconSearchPlaceholder: t('resources.resources.form.appearance.iconSearch', 'Search icons or emojis\u2026'),\n iconSearchEmptyLabel: t('resources.resources.form.appearance.iconSearchEmpty', 'No icons match your search'),\n iconSuggestionsLabel: t('resources.resources.form.appearance.iconSuggestions', 'Suggestions'),\n iconClearLabel: t('resources.resources.form.appearance.iconClear', 'Clear icon'),\n previewEmptyLabel: t('resources.resources.form.appearance.previewEmpty', 'No appearance selected'),\n }), [t])\n\n const fields = React.useMemo<CrudField[]>(() => {\n const baseFields: CrudField[] = [\n { id: 'name', label: t('resources.resources.form.fields.name', 'Name'), type: 'text', required: true },\n {\n id: 'description',\n label: t('resources.resources.form.fields.description', 'Description'),\n type: 'richtext',\n editor: 'uiw',\n },\n {\n id: 'resourceTypeId',\n label: t('resources.resources.form.fields.type', 'Resource type'),\n type: 'custom',\n component: ({ value, setValue, setFormValue, disabled }) => (\n <div className=\"flex items-center gap-2\">\n <select\n className=\"h-9 w-full rounded border px-2 text-sm\"\n value={typeof value === 'string' ? value : ''}\n onChange={(event) => {\n const next = event.target.value || ''\n setValue(next)\n if (setFormValue) {\n setFormValue('customFieldsetCode', resolveFieldsetCode(next || null))\n }\n }}\n data-crud-focus-target=\"\"\n disabled={disabled}\n >\n <option value=\"\">{t('ui.forms.select.emptyOption', '\u2014')}</option>\n {resourceTypes.map((type) => (\n <option key={type.id} value={type.id}>\n {type.name}\n </option>\n ))}\n </select>\n <Button\n asChild\n type=\"button\"\n variant=\"ghost\"\n size=\"icon\"\n className=\"shrink-0\"\n title={t('resources.resources.form.fields.type.manage', 'Manage resource types')}\n aria-label={t('resources.resources.form.fields.type.manage', 'Manage resource types')}\n disabled={disabled}\n >\n <Link href=\"/backend/resources/resource-types\">\n <Settings className=\"h-4 w-4\" aria-hidden />\n </Link>\n </Button>\n <Button\n asChild\n type=\"button\"\n variant=\"ghost\"\n size=\"icon\"\n className=\"shrink-0\"\n title={t('resources.resources.form.fields.type.add', 'Add resource type')}\n aria-label={t('resources.resources.form.fields.type.add', 'Add resource type')}\n disabled={disabled}\n >\n <Link href=\"/backend/resources/resource-types/create\">\n <Plus className=\"h-4 w-4\" aria-hidden />\n </Link>\n </Button>\n </div>\n ),\n },\n {\n id: 'capacity',\n label: t('resources.resources.form.fields.capacity', 'Capacity'),\n description: t(\n 'resources.resources.form.fields.capacity.help',\n 'Depends on the resource and can mean spots, units, quantity, or another type of capacity.',\n ),\n type: 'number',\n },\n {\n id: 'capacityUnitValue',\n label: t('resources.resources.form.fields.capacityUnit', 'Capacity unit'),\n type: 'custom',\n component: ({ value, setValue }) => {\n if (!capacityUnitDictionaryId) {\n return (\n <p className=\"text-xs text-muted-foreground\">\n {t('resources.resources.form.fields.capacityUnit.missing', 'Capacity unit dictionary is not configured.')}\n </p>\n )\n }\n return (\n <DictionarySelectControl\n dictionaryId={capacityUnitDictionaryId}\n value={typeof value === 'string' ? value : null}\n onChange={(next) => setValue(next ?? '')}\n selectClassName=\"w-full\"\n />\n )\n },\n },\n {\n id: 'appearance',\n label: t('resources.resources.form.appearance.label', 'Appearance'),\n type: 'custom',\n component: ({ value, setValue, disabled }) => {\n const appearance = value && typeof value === 'object'\n ? value as { icon?: string | null; color?: string | null }\n : {}\n return (\n <AppearanceSelector\n icon={appearance.icon ?? null}\n color={appearance.color ?? null}\n onIconChange={(next) => setValue({ ...appearance, icon: next })}\n onColorChange={(next) => setValue({ ...appearance, color: next })}\n labels={appearanceLabels}\n disabled={disabled}\n />\n )\n },\n },\n ]\n\n baseFields.push({\n id: 'isActive',\n label: t('resources.resources.form.fields.active', 'Active'),\n type: 'checkbox',\n })\n\n return baseFields\n }, [\n appearanceLabels,\n capacityUnitDictionaryId,\n resolveFieldsetCode,\n resourceTypes,\n t,\n ])\n\n const groups = React.useMemo<CrudFormGroup[]>(() => {\n const baseGroups: CrudFormGroup[] = [\n {\n id: 'details',\n column: 1,\n fields: [\n 'name',\n 'description',\n 'resourceTypeId',\n 'capacity',\n 'capacityUnitValue',\n 'appearance',\n 'isActive',\n ],\n },\n {\n id: 'custom',\n title: t('entities.customFields.title', 'Custom Attributes'),\n column: 2,\n kind: 'customFields',\n },\n ]\n\n if (tagsSection) {\n baseGroups.push({\n id: 'tags',\n column: 2,\n bare: true,\n component: () => (\n <TagsSection\n title={tagsSection.title}\n tags={tagsSection.tags}\n onChange={tagsSection.onChange}\n loadOptions={tagsSection.loadOptions}\n createTag={tagsSection.createTag}\n onSave={tagsSection.onSave}\n labels={tagsSection.labels}\n />\n ),\n })\n }\n\n return baseGroups\n }, [tagsSection, t])\n\n return { fields, groups, resolveFieldsetCode, resourceTypesLoaded }\n}\n\nexport type ResourcesResourceFormProps = {\n title: string\n submitLabel?: string\n backHref: string\n cancelHref: string\n embedded?: boolean\n successRedirect?: string\n initialValues?: Record<string, unknown>\n onSubmit: (values: Record<string, unknown>) => Promise<void>\n onDelete?: () => Promise<void>\n isLoading?: boolean\n loadingMessage?: string\n formConfig: ResourcesResourceFormConfig\n}\n\nexport function ResourcesResourceForm(props: ResourcesResourceFormProps) {\n const {\n title,\n submitLabel,\n backHref,\n cancelHref,\n embedded = false,\n successRedirect,\n initialValues,\n onSubmit,\n onDelete,\n isLoading,\n loadingMessage,\n formConfig,\n } = props\n const t = useT()\n const recordId = typeof initialValues?.id === 'string' ? initialValues.id : null\n const groups = React.useMemo<CrudFormGroup[]>(() => {\n const attachmentsGroup: CrudFormGroup = {\n id: 'attachments',\n title: t('attachments.library.title', 'Attachments'),\n column: 1,\n component: () => (\n <AttachmentsSection\n entityId={E.resources.resources_resource}\n recordId={recordId}\n showHeader={false}\n />\n ),\n }\n return [...formConfig.groups, attachmentsGroup]\n }, [formConfig.groups, recordId, t])\n\n return (\n <CrudForm\n embedded={embedded}\n title={title}\n backHref={backHref}\n versionHistory={recordId ? { resourceKind: 'resources.resource', resourceId: recordId } : undefined}\n cancelHref={cancelHref}\n submitLabel={submitLabel}\n successRedirect={successRedirect}\n fields={formConfig.fields}\n groups={groups}\n initialValues={initialValues}\n entityId={E.resources.resources_resource}\n customFieldsetBindings={{ [E.resources.resources_resource]: { valueKey: 'customFieldsetCode' } }}\n onSubmit={onSubmit}\n onDelete={onDelete}\n isLoading={isLoading}\n loadingMessage={loadingMessage}\n />\n )\n}\n"],
5
- "mappings": ";AAsIY,SAaE,KAbF;AApIZ,YAAY,WAAW;AACvB,SAAS,gBAAoD;AAC7D,SAAS,eAAe;AACxB,SAAS,+BAA+B;AACxC,SAAS,0BAA0B;AACnC,SAAS,oBAAoB,mBAA2D;AACxF,SAAS,cAAc;AACvB,SAAS,SAAS;AAClB,SAAS,YAAY;AACrB,SAAS,mCAAmC;AAC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B,oBAAoB;AACpE;AAiBO,SAAS,sBAAsB,OAAmC;AACvE,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,WAAW;AAAA,IACX;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,IAAI;AACJ,QAAM,IAAI,KAAK;AACf,QAAM,WAAW,OAAO,eAAe,OAAO,WAAW,cAAc,KAAK;AAC5E,QAAM,SAAS,MAAM,QAAyB,MAAM;AAClD,UAAM,mBAAkC;AAAA,MACtC,IAAI;AAAA,MACJ,OAAO,EAAE,6BAA6B,aAAa;AAAA,MACnD,QAAQ;AAAA,MACR,WAAW,MACT;AAAA,QAAC;AAAA;AAAA,UACC,UAAU,EAAE,UAAU;AAAA,UACtB;AAAA,UACA,YAAY;AAAA;AAAA,MACd;AAAA,IAEJ;AACA,WAAO,CAAC,GAAG,WAAW,QAAQ,gBAAgB;AAAA,EAChD,GAAG,CAAC,WAAW,QAAQ,UAAU,CAAC,CAAC;AAEnC,SACE;AAAA,IAAC;AAAA;AAAA,MACC;AAAA,MACA;AAAA,MACA;AAAA,MACA,gBAAgB,WAAW,EAAE,cAAc,sBAAsB,YAAY,SAAS,IAAI;AAAA,MAC1F;AAAA,MACA;AAAA,MACA;AAAA,MACA,QAAQ,WAAW;AAAA,MACnB;AAAA,MACA;AAAA,MACA,UAAU,EAAE,UAAU;AAAA,MACtB,wBAAwB,EAAE,CAAC,EAAE,UAAU,kBAAkB,GAAG,EAAE,UAAU,qBAAqB,EAAE;AAAA,MAC/F;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA;AAAA,EACF;AAEJ;",
6
- "names": []
4
+ "sourcesContent": ["\"use client\"\n\nimport * as React from 'react'\nimport { CrudForm, type CrudField, type CrudFormGroup } from '@open-mercato/ui/backend/CrudForm'\nimport { apiCall } from '@open-mercato/ui/backend/utils/apiCall'\nimport { DictionarySelectControl } from '@open-mercato/core/modules/dictionaries/components/DictionarySelectControl'\nimport { AppearanceSelector } from '@open-mercato/core/modules/dictionaries/components/AppearanceSelector'\nimport { AttachmentsSection, TagsSection, type TagOption, type TagsSectionLabels } from '@open-mercato/ui/backend/detail'\nimport { Button } from '@open-mercato/ui/primitives/button'\nimport {\n Select,\n SelectContent,\n SelectItem,\n SelectTrigger,\n SelectValue,\n} from '@open-mercato/ui/primitives/select'\nimport { E } from '#generated/entities.ids.generated'\nimport { useT } from '@open-mercato/shared/lib/i18n/context'\nimport { useOrganizationScopeVersion } from '@open-mercato/shared/lib/frontend/useOrganizationScope'\nimport { RESOURCES_CAPACITY_UNIT_DICTIONARY_KEY } from '@open-mercato/core/modules/resources/lib/capacityUnits'\nimport { RESOURCES_RESOURCE_FIELDSET_DEFAULT, resolveResourcesResourceFieldsetCode } from '@open-mercato/core/modules/resources/lib/resourceCustomFields'\nimport Link from 'next/link'\nimport { Plus, Settings } from 'lucide-react'\n\nconst DEFAULT_PAGE_SIZE = 100\n\ntype ResourceTypeRow = {\n id: string\n name: string\n}\n\ntype ResourceTypesResponse = {\n items: ResourceTypeRow[]\n}\n\ntype ResourceTagsSectionConfig = {\n title: string\n tags: TagOption[]\n onChange: (next: TagOption[]) => void\n loadOptions: (query?: string) => Promise<TagOption[]>\n createTag: (label: string) => Promise<TagOption>\n onSave: (payload: { next: TagOption[]; added: TagOption[]; removed: TagOption[] }) => Promise<void>\n labels: TagsSectionLabels\n}\n\nexport type ResourcesResourceFormConfig = {\n fields: CrudField[]\n groups: CrudFormGroup[]\n resolveFieldsetCode: (resourceTypeId?: string | null) => string\n resourceTypesLoaded: boolean\n}\n\nexport function useResourcesResourceFormConfig(options: {\n tagsSection?: ResourceTagsSectionConfig\n} = {}): ResourcesResourceFormConfig {\n const { tagsSection } = options\n const t = useT()\n const scopeVersion = useOrganizationScopeVersion()\n const [resourceTypes, setResourceTypes] = React.useState<ResourceTypeRow[]>([])\n const [resourceTypesLoaded, setResourceTypesLoaded] = React.useState(false)\n const [capacityUnitDictionaryId, setCapacityUnitDictionaryId] = React.useState<string | null>(null)\n\n React.useEffect(() => {\n let cancelled = false\n async function loadResourceTypes() {\n try {\n const params = new URLSearchParams({ page: '1', pageSize: String(DEFAULT_PAGE_SIZE) })\n const call = await apiCall<ResourceTypesResponse>(`/api/resources/resource-types?${params.toString()}`)\n if (!cancelled) {\n const items = Array.isArray(call.result?.items) ? call.result.items : []\n setResourceTypes(items)\n }\n } catch {\n if (!cancelled) setResourceTypes([])\n } finally {\n if (!cancelled) setResourceTypesLoaded(true)\n }\n }\n loadResourceTypes()\n return () => { cancelled = true }\n }, [scopeVersion])\n\n React.useEffect(() => {\n let cancelled = false\n async function loadCapacityUnitDictionary() {\n try {\n const call = await apiCall<{ items?: Array<{ id?: string; key?: string; isInherited?: boolean }> }>('/api/dictionaries')\n const items = Array.isArray(call.result?.items) ? call.result.items : []\n const matches = items.filter((item) => item?.key === RESOURCES_CAPACITY_UNIT_DICTIONARY_KEY)\n const preferred = matches.find((item) => item?.isInherited === false) ?? matches[0] ?? null\n if (!cancelled) setCapacityUnitDictionaryId(preferred?.id ?? null)\n } catch {\n if (!cancelled) setCapacityUnitDictionaryId(null)\n }\n }\n loadCapacityUnitDictionary()\n return () => { cancelled = true }\n }, [scopeVersion])\n\n const resourceFieldsetByTypeId = React.useMemo(() => {\n const map = new Map<string, string>()\n resourceTypes.forEach((type) => {\n map.set(type.id, resolveResourcesResourceFieldsetCode(type.name))\n })\n return map\n }, [resourceTypes])\n\n const resolveFieldsetCode = React.useCallback((resourceTypeId?: string | null) => {\n if (!resourceTypeId) return RESOURCES_RESOURCE_FIELDSET_DEFAULT\n return resourceFieldsetByTypeId.get(resourceTypeId) ?? RESOURCES_RESOURCE_FIELDSET_DEFAULT\n }, [resourceFieldsetByTypeId])\n\n const appearanceLabels = React.useMemo(() => ({\n colorLabel: t('resources.resources.form.appearance.colorLabel', 'Color'),\n colorHelp: t('resources.resources.form.appearance.colorHelp', 'Pick a color for this resource.'),\n colorClearLabel: t('resources.resources.form.appearance.colorClear', 'Clear color'),\n iconLabel: t('resources.resources.form.appearance.iconLabel', 'Icon'),\n iconPlaceholder: t('resources.resources.form.appearance.iconPlaceholder', 'Type an emoji or icon name'),\n iconPickerTriggerLabel: t('resources.resources.form.appearance.iconPicker', 'Browse icons'),\n iconSearchPlaceholder: t('resources.resources.form.appearance.iconSearch', 'Search icons or emojis\u2026'),\n iconSearchEmptyLabel: t('resources.resources.form.appearance.iconSearchEmpty', 'No icons match your search'),\n iconSuggestionsLabel: t('resources.resources.form.appearance.iconSuggestions', 'Suggestions'),\n iconClearLabel: t('resources.resources.form.appearance.iconClear', 'Clear icon'),\n previewEmptyLabel: t('resources.resources.form.appearance.previewEmpty', 'No appearance selected'),\n }), [t])\n\n const fields = React.useMemo<CrudField[]>(() => {\n const baseFields: CrudField[] = [\n { id: 'name', label: t('resources.resources.form.fields.name', 'Name'), type: 'text', required: true },\n {\n id: 'description',\n label: t('resources.resources.form.fields.description', 'Description'),\n type: 'richtext',\n editor: 'uiw',\n },\n {\n id: 'resourceTypeId',\n label: t('resources.resources.form.fields.type', 'Resource type'),\n type: 'custom',\n component: ({ value, setValue, setFormValue, disabled }) => (\n <div className=\"flex items-center gap-2\">\n <Select\n value={typeof value === 'string' && value ? value : undefined}\n onValueChange={(next) => {\n const value = next || ''\n setValue(value)\n if (setFormValue) {\n setFormValue('customFieldsetCode', resolveFieldsetCode(value || null))\n }\n }}\n disabled={disabled}\n >\n <SelectTrigger data-crud-focus-target=\"\">\n <SelectValue placeholder={t('ui.forms.select.emptyOption', '\u2014')} />\n </SelectTrigger>\n <SelectContent>\n {resourceTypes.map((type) => (\n <SelectItem key={type.id} value={type.id}>\n {type.name}\n </SelectItem>\n ))}\n </SelectContent>\n </Select>\n <Button\n asChild\n type=\"button\"\n variant=\"ghost\"\n size=\"icon\"\n className=\"shrink-0\"\n title={t('resources.resources.form.fields.type.manage', 'Manage resource types')}\n aria-label={t('resources.resources.form.fields.type.manage', 'Manage resource types')}\n disabled={disabled}\n >\n <Link href=\"/backend/resources/resource-types\">\n <Settings className=\"h-4 w-4\" aria-hidden />\n </Link>\n </Button>\n <Button\n asChild\n type=\"button\"\n variant=\"ghost\"\n size=\"icon\"\n className=\"shrink-0\"\n title={t('resources.resources.form.fields.type.add', 'Add resource type')}\n aria-label={t('resources.resources.form.fields.type.add', 'Add resource type')}\n disabled={disabled}\n >\n <Link href=\"/backend/resources/resource-types/create\">\n <Plus className=\"h-4 w-4\" aria-hidden />\n </Link>\n </Button>\n </div>\n ),\n },\n {\n id: 'capacity',\n label: t('resources.resources.form.fields.capacity', 'Capacity'),\n description: t(\n 'resources.resources.form.fields.capacity.help',\n 'Depends on the resource and can mean spots, units, quantity, or another type of capacity.',\n ),\n type: 'number',\n },\n {\n id: 'capacityUnitValue',\n label: t('resources.resources.form.fields.capacityUnit', 'Capacity unit'),\n type: 'custom',\n component: ({ value, setValue }) => {\n if (!capacityUnitDictionaryId) {\n return (\n <p className=\"text-xs text-muted-foreground\">\n {t('resources.resources.form.fields.capacityUnit.missing', 'Capacity unit dictionary is not configured.')}\n </p>\n )\n }\n return (\n <DictionarySelectControl\n dictionaryId={capacityUnitDictionaryId}\n value={typeof value === 'string' ? value : null}\n onChange={(next) => setValue(next ?? '')}\n selectClassName=\"w-full\"\n />\n )\n },\n },\n {\n id: 'appearance',\n label: t('resources.resources.form.appearance.label', 'Appearance'),\n type: 'custom',\n component: ({ value, setValue, disabled }) => {\n const appearance = value && typeof value === 'object'\n ? value as { icon?: string | null; color?: string | null }\n : {}\n return (\n <AppearanceSelector\n icon={appearance.icon ?? null}\n color={appearance.color ?? null}\n onIconChange={(next) => setValue({ ...appearance, icon: next })}\n onColorChange={(next) => setValue({ ...appearance, color: next })}\n labels={appearanceLabels}\n disabled={disabled}\n />\n )\n },\n },\n ]\n\n baseFields.push({\n id: 'isActive',\n label: t('resources.resources.form.fields.active', 'Active'),\n type: 'checkbox',\n })\n\n return baseFields\n }, [\n appearanceLabels,\n capacityUnitDictionaryId,\n resolveFieldsetCode,\n resourceTypes,\n t,\n ])\n\n const groups = React.useMemo<CrudFormGroup[]>(() => {\n const baseGroups: CrudFormGroup[] = [\n {\n id: 'details',\n column: 1,\n fields: [\n 'name',\n 'description',\n 'resourceTypeId',\n 'capacity',\n 'capacityUnitValue',\n 'appearance',\n 'isActive',\n ],\n },\n {\n id: 'custom',\n title: t('entities.customFields.title', 'Custom Attributes'),\n column: 2,\n kind: 'customFields',\n },\n ]\n\n if (tagsSection) {\n baseGroups.push({\n id: 'tags',\n column: 2,\n bare: true,\n component: () => (\n <TagsSection\n title={tagsSection.title}\n tags={tagsSection.tags}\n onChange={tagsSection.onChange}\n loadOptions={tagsSection.loadOptions}\n createTag={tagsSection.createTag}\n onSave={tagsSection.onSave}\n labels={tagsSection.labels}\n />\n ),\n })\n }\n\n return baseGroups\n }, [tagsSection, t])\n\n return { fields, groups, resolveFieldsetCode, resourceTypesLoaded }\n}\n\nexport type ResourcesResourceFormProps = {\n title: string\n submitLabel?: string\n backHref: string\n cancelHref: string\n embedded?: boolean\n successRedirect?: string\n initialValues?: Record<string, unknown>\n onSubmit: (values: Record<string, unknown>) => Promise<void>\n onDelete?: () => Promise<void>\n isLoading?: boolean\n loadingMessage?: string\n formConfig: ResourcesResourceFormConfig\n}\n\nexport function ResourcesResourceForm(props: ResourcesResourceFormProps) {\n const {\n title,\n submitLabel,\n backHref,\n cancelHref,\n embedded = false,\n successRedirect,\n initialValues,\n onSubmit,\n onDelete,\n isLoading,\n loadingMessage,\n formConfig,\n } = props\n const t = useT()\n const recordId = typeof initialValues?.id === 'string' ? initialValues.id : null\n const groups = React.useMemo<CrudFormGroup[]>(() => {\n const attachmentsGroup: CrudFormGroup = {\n id: 'attachments',\n title: t('attachments.library.title', 'Attachments'),\n column: 1,\n component: () => (\n <AttachmentsSection\n entityId={E.resources.resources_resource}\n recordId={recordId}\n showHeader={false}\n />\n ),\n }\n return [...formConfig.groups, attachmentsGroup]\n }, [formConfig.groups, recordId, t])\n\n return (\n <CrudForm\n embedded={embedded}\n title={title}\n backHref={backHref}\n versionHistory={recordId ? { resourceKind: 'resources.resource', resourceId: recordId } : undefined}\n cancelHref={cancelHref}\n submitLabel={submitLabel}\n successRedirect={successRedirect}\n fields={formConfig.fields}\n groups={groups}\n initialValues={initialValues}\n entityId={E.resources.resources_resource}\n customFieldsetBindings={{ [E.resources.resources_resource]: { valueKey: 'customFieldsetCode' } }}\n onSubmit={onSubmit}\n onDelete={onDelete}\n isLoading={isLoading}\n loadingMessage={loadingMessage}\n />\n )\n}\n"],
5
+ "mappings": ";AA6IY,SAYI,KAZJ;AA3IZ,YAAY,WAAW;AACvB,SAAS,gBAAoD;AAC7D,SAAS,eAAe;AACxB,SAAS,+BAA+B;AACxC,SAAS,0BAA0B;AACnC,SAAS,oBAAoB,mBAA2D;AACxF,SAAS,cAAc;AACvB;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,SAAS;AAClB,SAAS,YAAY;AACrB,SAAS,mCAAmC;AAC5C,SAAS,8CAA8C;AACvD,SAAS,qCAAqC,4CAA4C;AAC1F,OAAO,UAAU;AACjB,SAAS,MAAM,gBAAgB;AAE/B,MAAM,oBAAoB;AA4BnB,SAAS,+BAA+B,UAE3C,CAAC,GAAgC;AACnC,QAAM,EAAE,YAAY,IAAI;AACxB,QAAM,IAAI,KAAK;AACf,QAAM,eAAe,4BAA4B;AACjD,QAAM,CAAC,eAAe,gBAAgB,IAAI,MAAM,SAA4B,CAAC,CAAC;AAC9E,QAAM,CAAC,qBAAqB,sBAAsB,IAAI,MAAM,SAAS,KAAK;AAC1E,QAAM,CAAC,0BAA0B,2BAA2B,IAAI,MAAM,SAAwB,IAAI;AAElG,QAAM,UAAU,MAAM;AACpB,QAAI,YAAY;AAChB,mBAAe,oBAAoB;AACjC,UAAI;AACF,cAAM,SAAS,IAAI,gBAAgB,EAAE,MAAM,KAAK,UAAU,OAAO,iBAA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AAO,CAAC,GAAG,WAAW,QAAQ,gBAAgB;AAAA,EAChD,GAAG,CAAC,WAAW,QAAQ,UAAU,CAAC,CAAC;AAEnC,SACE;AAAA,IAAC;AAAA;AAAA,MACC;AAAA,MACA;AAAA,MACA;AAAA,MACA,gBAAgB,WAAW,EAAE,cAAc,sBAAsB,YAAY,SAAS,IAAI;AAAA,MAC1F;AAAA,MACA;AAAA,MACA;AAAA,MACA,QAAQ,WAAW;AAAA,MACnB;AAAA,MACA;AAAA,MACA,UAAU,EAAE,UAAU;AAAA,MACtB,wBAAwB,EAAE,CAAC,EAAE,UAAU,kBAAkB,GAAG,EAAE,UAAU,qBAAqB,EAAE;AAAA,MAC/F;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA;AAAA,EACF;AAEJ;",
6
+ "names": ["value"]
7
7
  }
@@ -828,24 +828,21 @@ function ContactEmailInlineEditor({
828
828
  }
829
829
  },
830
830
  children: [
831
- /* @__PURE__ */ jsxs("div", { className: "relative", children: [
832
- /* @__PURE__ */ jsx(Mail, { className: "pointer-events-none absolute left-2 top-2.5 h-4 w-4 text-muted-foreground" }),
833
- /* @__PURE__ */ jsx(
834
- "input",
835
- {
836
- className: "w-full rounded-md border pl-8 pr-3 py-2 text-sm focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
837
- value: draft,
838
- onChange: (event) => {
839
- if (error) setError(null);
840
- setDraft(event.target.value);
841
- },
842
- placeholder,
843
- type: "email",
844
- autoFocus: true,
845
- spellCheck: false
846
- }
847
- )
848
- ] }),
831
+ /* @__PURE__ */ jsx(
832
+ Input,
833
+ {
834
+ leftIcon: /* @__PURE__ */ jsx(Mail, {}),
835
+ value: draft,
836
+ onChange: (event) => {
837
+ if (error) setError(null);
838
+ setDraft(event.target.value);
839
+ },
840
+ placeholder,
841
+ type: "email",
842
+ autoFocus: true,
843
+ spellCheck: false
844
+ }
845
+ ),
849
846
  error ? /* @__PURE__ */ jsx("p", { className: "text-xs text-destructive", children: error }) : null,
850
847
  !error && duplicate ? /* @__PURE__ */ jsxs("p", { className: "text-xs text-muted-foreground", children: [
851
848
  t("customers.people.detail.inline.emailDuplicate", void 0, { name: duplicate.displayName }),