@open-mercato/ui 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 (96) hide show
  1. package/.turbo/turbo-build.log +1 -1
  2. package/AGENTS.md +8 -0
  3. package/dist/backend/CrudForm.js +57 -29
  4. package/dist/backend/CrudForm.js.map +2 -2
  5. package/dist/backend/DataTable.js +32 -14
  6. package/dist/backend/DataTable.js.map +2 -2
  7. package/dist/backend/FilterOverlay.js +23 -17
  8. package/dist/backend/FilterOverlay.js.map +2 -2
  9. package/dist/backend/JsonBuilder.js +32 -18
  10. package/dist/backend/JsonBuilder.js.map +2 -2
  11. package/dist/backend/columns/ColumnChooserPanel.js +12 -13
  12. package/dist/backend/columns/ColumnChooserPanel.js.map +2 -2
  13. package/dist/backend/custom-fields/FieldDefinitionsEditor.js +71 -62
  14. package/dist/backend/custom-fields/FieldDefinitionsEditor.js.map +2 -2
  15. package/dist/backend/date-range/DateRangeSelect.js +11 -10
  16. package/dist/backend/date-range/DateRangeSelect.js.map +2 -2
  17. package/dist/backend/date-range/InlineDateRangeSelect.js +10 -22
  18. package/dist/backend/date-range/InlineDateRangeSelect.js.map +2 -2
  19. package/dist/backend/detail/ActivitiesSection.js +20 -12
  20. package/dist/backend/detail/ActivitiesSection.js.map +2 -2
  21. package/dist/backend/detail/AddressEditor.js +24 -7
  22. package/dist/backend/detail/AddressEditor.js.map +2 -2
  23. package/dist/backend/detail/InlineEditors.js +12 -6
  24. package/dist/backend/detail/InlineEditors.js.map +2 -2
  25. package/dist/backend/detail/NotesSection.js +20 -14
  26. package/dist/backend/detail/NotesSection.js.map +2 -2
  27. package/dist/backend/filters/AdvancedFilterBuilder.js +52 -24
  28. package/dist/backend/filters/AdvancedFilterBuilder.js.map +2 -2
  29. package/dist/backend/injection/InjectedField.js +12 -7
  30. package/dist/backend/injection/InjectedField.js.map +2 -2
  31. package/dist/backend/inputs/ComboboxInput.js.map +2 -2
  32. package/dist/backend/inputs/EventSelect.js +22 -6
  33. package/dist/backend/inputs/EventSelect.js.map +2 -2
  34. package/dist/backend/inputs/PhoneNumberField.js +2 -2
  35. package/dist/backend/inputs/PhoneNumberField.js.map +2 -2
  36. package/dist/backend/inputs/TimeInput.js +9 -10
  37. package/dist/backend/inputs/TimeInput.js.map +2 -2
  38. package/dist/backend/messages/message-compose-form-groups.js +12 -7
  39. package/dist/backend/messages/message-compose-form-groups.js.map +2 -2
  40. package/dist/backend/messages/useMessageCompose.js +7 -1
  41. package/dist/backend/messages/useMessageCompose.js.map +2 -2
  42. package/dist/frontend/LanguageSwitcher.js +19 -14
  43. package/dist/frontend/LanguageSwitcher.js.map +2 -2
  44. package/dist/index.js +5 -0
  45. package/dist/index.js.map +2 -2
  46. package/dist/primitives/checkbox-field.js +17 -5
  47. package/dist/primitives/checkbox-field.js.map +2 -2
  48. package/dist/primitives/input.js +71 -14
  49. package/dist/primitives/input.js.map +2 -2
  50. package/dist/primitives/radio-field.js +74 -0
  51. package/dist/primitives/radio-field.js.map +7 -0
  52. package/dist/primitives/radio.js +37 -0
  53. package/dist/primitives/radio.js.map +7 -0
  54. package/dist/primitives/select.js +155 -0
  55. package/dist/primitives/select.js.map +7 -0
  56. package/dist/primitives/switch-field.js +76 -0
  57. package/dist/primitives/switch-field.js.map +7 -0
  58. package/dist/primitives/switch.js +17 -3
  59. package/dist/primitives/switch.js.map +2 -2
  60. package/dist/primitives/textarea.js +48 -12
  61. package/dist/primitives/textarea.js.map +2 -2
  62. package/dist/primitives/tooltip.js +44 -15
  63. package/dist/primitives/tooltip.js.map +2 -2
  64. package/package.json +5 -3
  65. package/src/backend/CrudForm.tsx +104 -37
  66. package/src/backend/DataTable.tsx +38 -20
  67. package/src/backend/FilterOverlay.tsx +35 -21
  68. package/src/backend/JsonBuilder.tsx +38 -20
  69. package/src/backend/__tests__/FieldDefinitionsEditor.test.tsx +23 -6
  70. package/src/backend/columns/ColumnChooserPanel.tsx +9 -10
  71. package/src/backend/custom-fields/FieldDefinitionsEditor.tsx +120 -87
  72. package/src/backend/date-range/DateRangeSelect.tsx +19 -12
  73. package/src/backend/date-range/InlineDateRangeSelect.tsx +16 -20
  74. package/src/backend/detail/ActivitiesSection.tsx +35 -23
  75. package/src/backend/detail/AddressEditor.tsx +30 -16
  76. package/src/backend/detail/InlineEditors.tsx +21 -11
  77. package/src/backend/detail/NotesSection.tsx +35 -25
  78. package/src/backend/filters/AdvancedFilterBuilder.tsx +60 -34
  79. package/src/backend/injection/InjectedField.tsx +21 -12
  80. package/src/backend/inputs/ComboboxInput.tsx +4 -0
  81. package/src/backend/inputs/EventSelect.tsx +30 -17
  82. package/src/backend/inputs/PhoneNumberField.tsx +2 -2
  83. package/src/backend/inputs/TimeInput.tsx +9 -10
  84. package/src/backend/messages/message-compose-form-groups.tsx +21 -12
  85. package/src/backend/messages/useMessageCompose.ts +20 -1
  86. package/src/frontend/LanguageSwitcher.tsx +20 -17
  87. package/src/index.ts +5 -0
  88. package/src/primitives/checkbox-field.tsx +10 -2
  89. package/src/primitives/input.tsx +73 -12
  90. package/src/primitives/radio-field.tsx +92 -0
  91. package/src/primitives/radio.tsx +42 -0
  92. package/src/primitives/select.tsx +200 -0
  93. package/src/primitives/switch-field.tsx +100 -0
  94. package/src/primitives/switch.tsx +17 -4
  95. package/src/primitives/textarea.tsx +67 -11
  96. package/src/primitives/tooltip.tsx +68 -24
@@ -4,6 +4,13 @@ import * as React from "react";
4
4
  import { Cog, GripVertical, Languages, Pencil, Plus, Trash2 } from "lucide-react";
5
5
  import { Button } from "../../primitives/button.js";
6
6
  import { IconButton } from "../../primitives/icon-button.js";
7
+ import {
8
+ Select,
9
+ SelectContent,
10
+ SelectItem,
11
+ SelectTrigger,
12
+ SelectValue
13
+ } from "../../primitives/select.js";
7
14
  import { CUSTOM_FIELD_KINDS } from "@open-mercato/shared/modules/entities/kinds";
8
15
  import { FieldRegistry } from "../fields/registry.js";
9
16
  import { slugify } from "@open-mercato/shared/lib/slugify";
@@ -225,14 +232,13 @@ function FieldDefinitionsEditor({
225
232
  /* @__PURE__ */ jsxs("div", { className: "flex flex-wrap items-center gap-2", children: [
226
233
  /* @__PURE__ */ jsx("label", { className: "text-xs font-medium text-muted-foreground", children: "Fieldset" }),
227
234
  /* @__PURE__ */ jsxs(
228
- "select",
235
+ Select,
229
236
  {
230
- className: "border rounded px-2 py-1 text-sm",
231
- value: resolvedActiveFieldset ?? "",
232
- onChange: (event) => handleActiveFieldsetChange(event.target.value),
237
+ value: resolvedActiveFieldset || void 0,
238
+ onValueChange: (value) => handleActiveFieldsetChange(value ?? ""),
233
239
  children: [
234
- /* @__PURE__ */ jsx("option", { value: "", children: "Unassigned fields" }),
235
- fieldsets.map((fs) => /* @__PURE__ */ jsx("option", { value: fs.code, children: fs.label || fs.code }, fs.code))
240
+ /* @__PURE__ */ jsx(SelectTrigger, { size: "sm", className: "w-auto min-w-[10rem]", children: /* @__PURE__ */ jsx(SelectValue, { placeholder: "Unassigned fields" }) }),
241
+ /* @__PURE__ */ jsx(SelectContent, { children: fieldsets.map((fs) => /* @__PURE__ */ jsx(SelectItem, { value: fs.code, children: fs.label || fs.code }, fs.code)) })
236
242
  ]
237
243
  }
238
244
  ),
@@ -290,16 +296,15 @@ function FieldDefinitionsEditor({
290
296
  /* @__PURE__ */ jsxs("div", { children: [
291
297
  /* @__PURE__ */ jsx("label", { className: "text-xs", children: "Icon" }),
292
298
  /* @__PURE__ */ jsxs(
293
- "select",
299
+ Select,
294
300
  {
295
- className: "border rounded w-full px-2 py-1 text-sm",
296
- value: activeFieldsetConfig.icon ?? "",
297
- onChange: (event) => handleFieldsetPatch(activeFieldsetConfig.code, {
298
- icon: event.target.value || void 0
301
+ value: activeFieldsetConfig.icon || void 0,
302
+ onValueChange: (value) => handleFieldsetPatch(activeFieldsetConfig.code, {
303
+ icon: value || void 0
299
304
  }),
300
305
  children: [
301
- /* @__PURE__ */ jsx("option", { value: "", children: "Default" }),
302
- FIELDSET_ICON_OPTIONS.map((option) => /* @__PURE__ */ jsx("option", { value: option.value, children: option.label }, option.value))
306
+ /* @__PURE__ */ jsx(SelectTrigger, { size: "sm", children: /* @__PURE__ */ jsx(SelectValue, { placeholder: "Default" }) }),
307
+ /* @__PURE__ */ jsx(SelectContent, { children: FIELDSET_ICON_OPTIONS.map((option) => /* @__PURE__ */ jsx(SelectItem, { value: option.value, children: option.label }, option.value)) })
303
308
  ]
304
309
  }
305
310
  )
@@ -677,15 +682,17 @@ const FieldDefinitionCard = React.memo(function FieldDefinitionCard2({
677
682
  ] }),
678
683
  /* @__PURE__ */ jsxs("div", { className: "md:col-span-6", children: [
679
684
  /* @__PURE__ */ jsx("label", { className: "text-xs", children: "Kind" }),
680
- /* @__PURE__ */ jsx(
681
- "select",
685
+ /* @__PURE__ */ jsxs(
686
+ Select,
682
687
  {
683
- className: `rounded w-full px-2 py-1 text-sm ${error?.kind ? "border-red-500 border" : "border"}`,
684
- value: local.kind,
685
- onChange: (event) => {
686
- apply({ kind: event.target.value }, true);
688
+ value: local.kind || void 0,
689
+ onValueChange: (value) => {
690
+ apply({ kind: value ?? "" }, true);
687
691
  },
688
- children: kindOptions.map((option) => /* @__PURE__ */ jsx("option", { value: option.value, children: option.label }, option.value))
692
+ children: [
693
+ /* @__PURE__ */ jsx(SelectTrigger, { className: error?.kind ? "border-destructive" : void 0, children: /* @__PURE__ */ jsx(SelectValue, {}) }),
694
+ /* @__PURE__ */ jsx(SelectContent, { children: kindOptions.map((option) => /* @__PURE__ */ jsx(SelectItem, { value: option.value, children: option.label }, option.value)) })
695
+ ]
689
696
  }
690
697
  ),
691
698
  error?.kind ? /* @__PURE__ */ jsx("div", { className: "text-xs text-red-600 mt-1", children: error.kind }) : null
@@ -695,14 +702,13 @@ const FieldDefinitionCard = React.memo(function FieldDefinitionCard2({
695
702
  /* @__PURE__ */ jsxs("div", { children: [
696
703
  /* @__PURE__ */ jsx("label", { className: "text-xs", children: "Assign to fieldset" }),
697
704
  /* @__PURE__ */ jsxs(
698
- "select",
705
+ Select,
699
706
  {
700
- className: "border rounded w-full px-2 py-1 text-sm",
701
- value: currentFieldsetValue,
702
- onChange: (event) => handleFieldsetSelect(event.target.value),
707
+ value: currentFieldsetValue || void 0,
708
+ onValueChange: (value) => handleFieldsetSelect(value ?? ""),
703
709
  children: [
704
- /* @__PURE__ */ jsx("option", { value: "", children: "Unassigned" }),
705
- (fieldsets || []).map((fs) => /* @__PURE__ */ jsx("option", { value: fs.code, children: fs.label || fs.code }, fs.code))
710
+ /* @__PURE__ */ jsx(SelectTrigger, { children: /* @__PURE__ */ jsx(SelectValue, { placeholder: "Unassigned" }) }),
711
+ /* @__PURE__ */ jsx(SelectContent, { children: (fieldsets || []).map((fs) => /* @__PURE__ */ jsx(SelectItem, { value: fs.code, children: fs.label || fs.code }, fs.code)) })
706
712
  ]
707
713
  }
708
714
  )
@@ -711,14 +717,13 @@ const FieldDefinitionCard = React.memo(function FieldDefinitionCard2({
711
717
  /* @__PURE__ */ jsx("div", { className: "flex items-center justify-between", children: /* @__PURE__ */ jsx("label", { className: "text-xs", children: "Group" }) }),
712
718
  /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 mt-1", children: [
713
719
  /* @__PURE__ */ jsxs(
714
- "select",
720
+ Select,
715
721
  {
716
- className: "flex-1 border rounded px-2 py-1 text-sm",
717
- value: currentGroup?.code ?? "",
718
- onChange: (event) => handleGroupSelect(event.target.value),
722
+ value: currentGroup?.code || void 0,
723
+ onValueChange: (value) => handleGroupSelect(value ?? ""),
719
724
  children: [
720
- /* @__PURE__ */ jsx("option", { value: "", children: "No group" }),
721
- groupOptions.map((group) => /* @__PURE__ */ jsx("option", { value: group.code, children: group.title || group.code }, group.code))
725
+ /* @__PURE__ */ jsx(SelectTrigger, { className: "flex-1", children: /* @__PURE__ */ jsx(SelectValue, { placeholder: "No group" }) }),
726
+ /* @__PURE__ */ jsx(SelectContent, { children: groupOptions.map((group) => /* @__PURE__ */ jsx(SelectItem, { value: group.code, children: group.title || group.code }, group.code)) })
722
727
  ]
723
728
  }
724
729
  ),
@@ -774,18 +779,19 @@ const FieldDefinitionCard = React.memo(function FieldDefinitionCard2({
774
779
  /* @__PURE__ */ jsxs("div", { children: [
775
780
  /* @__PURE__ */ jsx("label", { className: "text-xs", children: "Editor" }),
776
781
  /* @__PURE__ */ jsxs(
777
- "select",
782
+ Select,
778
783
  {
779
- className: "border rounded w-full px-2 py-1 text-sm",
780
- value: typeof local.configJson?.editor === "string" ? local.configJson.editor : "",
781
- onChange: (event) => {
782
- apply({ configJson: { ...local.configJson || {}, editor: event.target.value || void 0 } }, true);
784
+ value: typeof local.configJson?.editor === "string" && local.configJson.editor ? local.configJson.editor : void 0,
785
+ onValueChange: (value) => {
786
+ apply({ configJson: { ...local.configJson || {}, editor: value || void 0 } }, true);
783
787
  },
784
788
  children: [
785
- /* @__PURE__ */ jsx("option", { value: "", children: "Default" }),
786
- /* @__PURE__ */ jsx("option", { value: "markdown", children: "Markdown (UIW)" }),
787
- /* @__PURE__ */ jsx("option", { value: "simpleMarkdown", children: "Simple Markdown" }),
788
- /* @__PURE__ */ jsx("option", { value: "htmlRichText", children: "HTML Rich Text" })
789
+ /* @__PURE__ */ jsx(SelectTrigger, { children: /* @__PURE__ */ jsx(SelectValue, { placeholder: "Default" }) }),
790
+ /* @__PURE__ */ jsxs(SelectContent, { children: [
791
+ /* @__PURE__ */ jsx(SelectItem, { value: "markdown", children: "Markdown (UIW)" }),
792
+ /* @__PURE__ */ jsx(SelectItem, { value: "simpleMarkdown", children: "Simple Markdown" }),
793
+ /* @__PURE__ */ jsx(SelectItem, { value: "htmlRichText", children: "HTML Rich Text" })
794
+ ] })
789
795
  ]
790
796
  }
791
797
  )
@@ -800,20 +806,21 @@ const FieldDefinitionCard = React.memo(function FieldDefinitionCard2({
800
806
  !!local.configJson?.multi && /* @__PURE__ */ jsxs("div", { className: "md:col-span-2", children: [
801
807
  /* @__PURE__ */ jsx("label", { className: "text-xs", children: "Multi-select input style" }),
802
808
  /* @__PURE__ */ jsxs(
803
- "select",
809
+ Select,
804
810
  {
805
- className: "border rounded w-full px-2 py-1 text-sm",
806
811
  value: local.configJson?.input === "listbox" ? "listbox" : "default",
807
- onChange: (event) => {
808
- const { value } = event.target;
812
+ onValueChange: (value) => {
809
813
  const nextConfig = { ...local.configJson || {} };
810
814
  if (value === "listbox") nextConfig.input = "listbox";
811
815
  else delete nextConfig.input;
812
816
  apply({ configJson: nextConfig }, true);
813
817
  },
814
818
  children: [
815
- /* @__PURE__ */ jsx("option", { value: "default", children: "Default" }),
816
- /* @__PURE__ */ jsx("option", { value: "listbox", children: "Listbox (searchable)" })
819
+ /* @__PURE__ */ jsx(SelectTrigger, { children: /* @__PURE__ */ jsx(SelectValue, {}) }),
820
+ /* @__PURE__ */ jsxs(SelectContent, { children: [
821
+ /* @__PURE__ */ jsx(SelectItem, { value: "default", children: "Default" }),
822
+ /* @__PURE__ */ jsx(SelectItem, { value: "listbox", children: "Listbox (searchable)" })
823
+ ] })
817
824
  ]
818
825
  }
819
826
  )
@@ -942,12 +949,11 @@ const FieldDefinitionCard = React.memo(function FieldDefinitionCard2({
942
949
  /* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
943
950
  (Array.isArray(local.configJson?.validation) ? local.configJson.validation : []).map((rule, index) => /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-1 md:grid-cols-12 gap-2 items-center", children: [
944
951
  /* @__PURE__ */ jsx("div", { className: "md:col-span-3", children: /* @__PURE__ */ jsxs(
945
- "select",
952
+ Select,
946
953
  {
947
- className: "border rounded w-full px-2 py-1 text-sm",
948
954
  value: rule?.rule || "required",
949
- onChange: (event) => {
950
- const nextRule = event.target.value;
955
+ onValueChange: (value) => {
956
+ const nextRule = value;
951
957
  apply((current) => {
952
958
  const list = Array.isArray(current.configJson?.validation) ? [...current.configJson.validation] : [];
953
959
  const existing = list[index] || {};
@@ -956,17 +962,20 @@ const FieldDefinitionCard = React.memo(function FieldDefinitionCard2({
956
962
  }, true);
957
963
  },
958
964
  children: [
959
- /* @__PURE__ */ jsx("option", { value: "required", children: "required" }),
960
- /* @__PURE__ */ jsx("option", { value: "date", children: "date" }),
961
- /* @__PURE__ */ jsx("option", { value: "integer", children: "integer" }),
962
- /* @__PURE__ */ jsx("option", { value: "float", children: "float" }),
963
- /* @__PURE__ */ jsx("option", { value: "lt", children: "lt" }),
964
- /* @__PURE__ */ jsx("option", { value: "lte", children: "lte" }),
965
- /* @__PURE__ */ jsx("option", { value: "gt", children: "gt" }),
966
- /* @__PURE__ */ jsx("option", { value: "gte", children: "gte" }),
967
- /* @__PURE__ */ jsx("option", { value: "eq", children: "eq" }),
968
- /* @__PURE__ */ jsx("option", { value: "ne", children: "ne" }),
969
- /* @__PURE__ */ jsx("option", { value: "regex", children: "regex" })
965
+ /* @__PURE__ */ jsx(SelectTrigger, { children: /* @__PURE__ */ jsx(SelectValue, {}) }),
966
+ /* @__PURE__ */ jsxs(SelectContent, { children: [
967
+ /* @__PURE__ */ jsx(SelectItem, { value: "required", children: "required" }),
968
+ /* @__PURE__ */ jsx(SelectItem, { value: "date", children: "date" }),
969
+ /* @__PURE__ */ jsx(SelectItem, { value: "integer", children: "integer" }),
970
+ /* @__PURE__ */ jsx(SelectItem, { value: "float", children: "float" }),
971
+ /* @__PURE__ */ jsx(SelectItem, { value: "lt", children: "lt" }),
972
+ /* @__PURE__ */ jsx(SelectItem, { value: "lte", children: "lte" }),
973
+ /* @__PURE__ */ jsx(SelectItem, { value: "gt", children: "gt" }),
974
+ /* @__PURE__ */ jsx(SelectItem, { value: "gte", children: "gte" }),
975
+ /* @__PURE__ */ jsx(SelectItem, { value: "eq", children: "eq" }),
976
+ /* @__PURE__ */ jsx(SelectItem, { value: "ne", children: "ne" }),
977
+ /* @__PURE__ */ jsx(SelectItem, { value: "regex", children: "regex" })
978
+ ] })
970
979
  ]
971
980
  }
972
981
  ) }),