@lunejs/admin-ui 0.1.5 → 0.2.1

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 (115) hide show
  1. package/dist/_virtual/index10.js +5 -2
  2. package/dist/_virtual/index11.js +4 -0
  3. package/dist/_virtual/index6.js +3 -3
  4. package/dist/_virtual/index8.js +3 -5
  5. package/dist/lib/api/codegen/graphql.d.ts +1 -0
  6. package/dist/lib/api/codegen/graphql.js +8 -8
  7. package/dist/lib/collections/components/collection-details/cards/general-card.js +20 -14
  8. package/dist/lib/custom-fields/components/details/is-list/custom-field-is-list.js +6 -4
  9. package/dist/lib/custom-fields/components/details/use-form/form-schema.d.ts +1 -0
  10. package/dist/lib/custom-fields/components/details/use-form/form-schema.js +4 -3
  11. package/dist/lib/custom-fields/components/fields/color.js +3 -3
  12. package/dist/lib/custom-fields/components/fields/custom-field.js +44 -36
  13. package/dist/lib/custom-fields/components/fields/rich-text.d.ts +8 -0
  14. package/dist/lib/custom-fields/components/fields/rich-text.js +17 -0
  15. package/dist/lib/custom-fields/components/fields/shared/primitive.d.ts +2 -1
  16. package/dist/lib/custom-fields/components/fields/shared/primitive.js +67 -61
  17. package/dist/lib/custom-fields/utils/custom-field.utils.js +63 -51
  18. package/dist/lib/dashboard/pages/dashboard-page.js +5 -5
  19. package/dist/lib/product/components/product-details/cards/general-product-card.js +18 -12
  20. package/dist/lib/translate/components/form/translate-form-row-data.d.ts +2 -1
  21. package/dist/lib/translate/components/form/translate-form-row-data.js +51 -19
  22. package/dist/lib/translate/components/form/translate-rich-text.d.ts +8 -0
  23. package/dist/lib/translate/components/form/translate-rich-text.js +65 -0
  24. package/dist/lib/translate/components/product-form/custom-fields/translate-product-custom-fields.js +95 -63
  25. package/dist/lib/translate/components/product-form/translate-product-form.js +19 -18
  26. package/dist/node_modules/@tiptap/core/dist/index.js +3566 -0
  27. package/dist/node_modules/@tiptap/core/dist/jsx-runtime/jsx-runtime.js +17 -0
  28. package/dist/node_modules/@tiptap/extension-bold/dist/index.js +80 -0
  29. package/dist/node_modules/@tiptap/extension-document/dist/index.js +13 -0
  30. package/dist/node_modules/@tiptap/extension-heading/dist/index.js +64 -0
  31. package/dist/node_modules/@tiptap/extension-italic/dist/index.js +78 -0
  32. package/dist/node_modules/@tiptap/extension-link/dist/index.js +305 -0
  33. package/dist/node_modules/@tiptap/extension-list/dist/index.js +713 -0
  34. package/dist/node_modules/@tiptap/extension-paragraph/dist/index.js +42 -0
  35. package/dist/node_modules/@tiptap/extension-table/dist/index.js +380 -0
  36. package/dist/node_modules/@tiptap/extension-text/dist/index.js +14 -0
  37. package/dist/node_modules/@tiptap/extension-text-style/dist/index.js +240 -0
  38. package/dist/node_modules/@tiptap/extension-underline/dist/index.js +66 -0
  39. package/dist/node_modules/@tiptap/extensions/dist/index.js +288 -0
  40. package/dist/node_modules/@tiptap/react/dist/index.js +482 -0
  41. package/dist/node_modules/es-toolkit/dist/compat/object/cloneDeep.js +1 -1
  42. package/dist/node_modules/es-toolkit/dist/object/cloneDeep.js +1 -1
  43. package/dist/node_modules/eventemitter3/index.js +1 -1
  44. package/dist/node_modules/eventemitter3/index2.js +1 -1
  45. package/dist/node_modules/fast-equals/dist/es/index.js +324 -0
  46. package/dist/node_modules/linkifyjs/dist/linkify.js +707 -0
  47. package/dist/node_modules/lucide-react/dist/esm/icons/baseline.js +10 -0
  48. package/dist/node_modules/lucide-react/dist/esm/icons/between-horizontal-end.js +10 -0
  49. package/dist/node_modules/lucide-react/dist/esm/icons/between-vertical-end.js +10 -0
  50. package/dist/node_modules/lucide-react/dist/esm/icons/bold.js +11 -0
  51. package/dist/node_modules/lucide-react/dist/esm/icons/grid-2x2-plus.js +16 -0
  52. package/dist/node_modules/lucide-react/dist/esm/icons/grid-2x2-x.js +16 -0
  53. package/dist/node_modules/lucide-react/dist/esm/icons/italic.js +10 -0
  54. package/dist/node_modules/lucide-react/dist/esm/icons/layout-list.js +13 -0
  55. package/dist/node_modules/lucide-react/dist/esm/icons/link.js +9 -0
  56. package/dist/node_modules/lucide-react/dist/esm/icons/list-ordered.js +13 -0
  57. package/dist/node_modules/lucide-react/dist/esm/icons/table-columns-split.js +18 -0
  58. package/dist/node_modules/lucide-react/dist/esm/icons/table-rows-split.js +18 -0
  59. package/dist/node_modules/lucide-react/dist/esm/icons/table.js +11 -0
  60. package/dist/node_modules/lucide-react/dist/esm/icons/underline.js +9 -0
  61. package/dist/node_modules/orderedmap/dist/index.js +103 -0
  62. package/dist/node_modules/prosemirror-commands/dist/index.js +388 -0
  63. package/dist/node_modules/prosemirror-dropcursor/dist/index.js +86 -0
  64. package/dist/node_modules/prosemirror-gapcursor/dist/index.js +204 -0
  65. package/dist/node_modules/prosemirror-history/dist/index.js +248 -0
  66. package/dist/node_modules/prosemirror-keymap/dist/index.js +62 -0
  67. package/dist/node_modules/prosemirror-model/dist/index.js +2733 -0
  68. package/dist/node_modules/prosemirror-schema-list/dist/index.js +88 -0
  69. package/dist/node_modules/prosemirror-state/dist/index.js +822 -0
  70. package/dist/node_modules/prosemirror-tables/dist/index.js +1446 -0
  71. package/dist/node_modules/prosemirror-transform/dist/index.js +1520 -0
  72. package/dist/node_modules/prosemirror-view/dist/index.js +3772 -0
  73. package/dist/node_modules/react-is/index.js +1 -1
  74. package/dist/node_modules/recharts/es6/util/Events.js +1 -1
  75. package/dist/node_modules/recharts/es6/util/ReactUtils.js +1 -1
  76. package/dist/node_modules/rope-sequence/dist/index.js +100 -0
  77. package/dist/node_modules/use-sync-external-store/shim/index.js +1 -1
  78. package/dist/node_modules/w3c-keyname/index.js +93 -0
  79. package/dist/packages/lune-ui/dist/_virtual/index3.js +2 -5
  80. package/dist/packages/lune-ui/dist/_virtual/index6.js +5 -2
  81. package/dist/packages/lune-ui/dist/components/popover.js +15 -11
  82. package/dist/packages/lune-ui/dist/components/select.js +6 -6
  83. package/dist/packages/lune-ui/dist/form/form-date-picker.js +2 -2
  84. package/dist/packages/lune-ui/dist/form/form.js +4 -4
  85. package/dist/packages/lune-ui/dist/node_modules/@radix-ui/react-popover/dist/index.js +39 -38
  86. package/dist/packages/lune-ui/dist/node_modules/prop-types/index.js +1 -1
  87. package/dist/packages/lune-ui/dist/packages/lune-ui/node_modules/recharts/es6/util/Events.js +1 -1
  88. package/dist/shared/components/color-picker/color-picker.d.ts +2 -1
  89. package/dist/shared/components/color-picker/color-picker.js +11 -11
  90. package/dist/shared/components/data-table/data-table-filter.js +4 -4
  91. package/dist/shared/components/rich-editor/rich-editor.d.ts +8 -0
  92. package/dist/shared/components/rich-editor/rich-editor.js +97 -0
  93. package/dist/shared/components/rich-editor/toolbar/bold/rich-editor-toolbar-bold.d.ts +1 -0
  94. package/dist/shared/components/rich-editor/toolbar/bold/rich-editor-toolbar-bold.js +66 -0
  95. package/dist/shared/components/rich-editor/toolbar/color/rich-editor-toolbar-color.d.ts +1 -0
  96. package/dist/shared/components/rich-editor/toolbar/color/rich-editor-toolbar-color.js +66 -0
  97. package/dist/shared/components/rich-editor/toolbar/heading/rich-editor-toolbar-heading.d.ts +1 -0
  98. package/dist/shared/components/rich-editor/toolbar/heading/rich-editor-toolbar-heading.js +115 -0
  99. package/dist/shared/components/rich-editor/toolbar/italic/rich-editor-toolbar-italic.d.ts +1 -0
  100. package/dist/shared/components/rich-editor/toolbar/italic/rich-editor-toolbar-italic.js +66 -0
  101. package/dist/shared/components/rich-editor/toolbar/link/rich-editor-toolbar-link-form.d.ts +2 -0
  102. package/dist/shared/components/rich-editor/toolbar/link/rich-editor-toolbar-link-form.js +103 -0
  103. package/dist/shared/components/rich-editor/toolbar/link/rich-editor-toolbar-link.d.ts +1 -0
  104. package/dist/shared/components/rich-editor/toolbar/link/rich-editor-toolbar-link.js +64 -0
  105. package/dist/shared/components/rich-editor/toolbar/ol-list/rich-editor-toolbar-ul-list.d.ts +1 -0
  106. package/dist/shared/components/rich-editor/toolbar/ol-list/rich-editor-toolbar-ul-list.js +66 -0
  107. package/dist/shared/components/rich-editor/toolbar/table/rich-editor-toolbar-table.d.ts +1 -0
  108. package/dist/shared/components/rich-editor/toolbar/table/rich-editor-toolbar-table.js +108 -0
  109. package/dist/shared/components/rich-editor/toolbar/toolbar.d.ts +1 -0
  110. package/dist/shared/components/rich-editor/toolbar/toolbar.js +64 -0
  111. package/dist/shared/components/rich-editor/toolbar/ul-list/rich-editor-toolbar-ul-list.d.ts +1 -0
  112. package/dist/shared/components/rich-editor/toolbar/ul-list/rich-editor-toolbar-ul-list.js +66 -0
  113. package/dist/shared/components/rich-editor/toolbar/underline/rich-editor-toolbar-underline.d.ts +1 -0
  114. package/dist/shared/components/rich-editor/toolbar/underline/rich-editor-toolbar-underline.js +66 -0
  115. package/package.json +6 -1
@@ -10,7 +10,7 @@ import "../../../../../packages/lune-ui/dist/node_modules/react-day-picker/dist/
10
10
  import "../../../../../packages/lune-ui/dist/node_modules/@date-fns/tz/date/mini.js";
11
11
  import "../../../../../packages/lune-ui/dist/node_modules/react-day-picker/dist/esm/helpers/calculateFocusTarget.js";
12
12
  import "../../../../../packages/lune-ui/dist/node_modules/react-day-picker/dist/esm/locale/en-US.js";
13
- import { Card as i, CardHeader as m, CardTitle as p, CardContent as e } from "../../../../../packages/lune-ui/dist/components/card.js";
13
+ import { Card as m, CardHeader as e, CardTitle as p, CardContent as l } from "../../../../../packages/lune-ui/dist/components/card.js";
14
14
  import "../../../../../packages/lune-ui/dist/components/chart.js";
15
15
  import "../../../../../packages/lune-ui/dist/node_modules/@radix-ui/react-checkbox/dist/index.js";
16
16
  import "../../../../../packages/lune-ui/dist/node_modules/@radix-ui/react-collapsible/dist/index.js";
@@ -31,21 +31,27 @@ import "../../../../../packages/lune-ui/dist/node_modules/@radix-ui/react-toggle
31
31
  import "../../../../../packages/lune-ui/dist/components/toggle-group.js";
32
32
  import "../../../../../packages/lune-ui/dist/node_modules/@radix-ui/react-tooltip/dist/index.js";
33
33
  import "../../../../../packages/lune-ui/dist/form/form.js";
34
- import { FormInput as l } from "../../../../../packages/lune-ui/dist/form/form-input.js";
35
- import { FormTextarea as a } from "../../../../../packages/lune-ui/dist/form/form-textarea.js";
36
- import { CollectionAssetUploader as n } from "../../asset-uploader/collection-asset-uploader.js";
37
- import { useCollectionDetailsFormContext as c } from "../use-form/use-form.js";
38
- const W = () => {
39
- const r = c();
40
- return /* @__PURE__ */ t(i, { children: [
41
- /* @__PURE__ */ o(m, { className: "flex", children: /* @__PURE__ */ o(p, { children: "General" }) }),
42
- /* @__PURE__ */ t(e, { className: "flex flex-col gap-3", children: [
43
- /* @__PURE__ */ o(l, { control: r.control, name: "name", label: "Name", placeholder: "Electronics" }),
44
- /* @__PURE__ */ o(a, { control: r.control, name: "description", label: "Description" }),
45
- /* @__PURE__ */ o(n, { collection: r.collection })
34
+ import { FormInput as a } from "../../../../../packages/lune-ui/dist/form/form-input.js";
35
+ import { RichEditor as n } from "../../../../../shared/components/rich-editor/rich-editor.js";
36
+ import { CollectionAssetUploader as c } from "../../asset-uploader/collection-asset-uploader.js";
37
+ import { useCollectionDetailsFormContext as s } from "../use-form/use-form.js";
38
+ const X = () => {
39
+ const r = s();
40
+ return /* @__PURE__ */ t(m, { children: [
41
+ /* @__PURE__ */ o(e, { className: "flex", children: /* @__PURE__ */ o(p, { children: "General" }) }),
42
+ /* @__PURE__ */ t(l, { className: "flex flex-col gap-3", children: [
43
+ /* @__PURE__ */ o(a, { control: r.control, name: "name", label: "Name", placeholder: "Electronics" }),
44
+ /* @__PURE__ */ o(
45
+ n,
46
+ {
47
+ defaultValue: r.formState.defaultValues?.description,
48
+ onChange: (i) => r.setValue("description", i)
49
+ }
50
+ ),
51
+ /* @__PURE__ */ o(c, { collection: r.collection })
46
52
  ] })
47
53
  ] });
48
54
  };
49
55
  export {
50
- W as CollectionGeneralCard
56
+ X as CollectionGeneralCard
51
57
  };
@@ -31,14 +31,16 @@ import "../../../../../packages/lune-ui/dist/components/toggle-group.js";
31
31
  import "../../../../../packages/lune-ui/dist/node_modules/@radix-ui/react-tooltip/dist/index.js";
32
32
  import "../../../../../packages/lune-ui/dist/form/form.js";
33
33
  import { FormSelect as a } from "../../../../../packages/lune-ui/dist/form/form-select.js";
34
- import { CustomFieldType as i } from "../../../../api/codegen/graphql.js";
34
+ import { CustomFieldType as o } from "../../../../api/codegen/graphql.js";
35
35
  import { useCustomFieldFormContext as u } from "../use-form/use-form.js";
36
36
  import c from "../../../../../node_modules/lucide-react/dist/esm/icons/circle.js";
37
37
  import f from "../../../../../node_modules/lucide-react/dist/esm/icons/list.js";
38
38
  const Z = () => {
39
- const { control: m, watch: r, definition: p, setValue: e } = u(), o = r("type"), t = l(
40
- () => [i.Boolean, i.MultiLineText].includes(o),
41
- [o]
39
+ const { control: m, watch: r, definition: p, setValue: e } = u(), i = r("type"), t = l(
40
+ () => [o.Boolean, o.MultiLineText, o.RichText].includes(
41
+ i
42
+ ),
43
+ [i]
42
44
  );
43
45
  return n(() => {
44
46
  t && e("quantity", "single");
@@ -14,6 +14,7 @@ export declare const CustomFieldDetailsSchema: z.ZodObject<{
14
14
  MONEY: CustomFieldType.Money;
15
15
  MULTI_LINE_TEXT: CustomFieldType.MultiLineText;
16
16
  PRODUCT_REFERENCE: CustomFieldType.ProductReference;
17
+ RICH_TEXT: CustomFieldType.RichText;
17
18
  SINGLE_LINE_TEXT: CustomFieldType.SingleLineText;
18
19
  URL: CustomFieldType.Url;
19
20
  }>;
@@ -1,7 +1,7 @@
1
1
  import * as t from "../../../../../node_modules/zod/v4/classic/external.js";
2
2
  import { CustomFieldType as e } from "../../../../api/codegen/graphql.js";
3
3
  import { FormMessages as o } from "../../../../../shared/forms/form-messages.js";
4
- const i = t.object({
4
+ const r = t.object({
5
5
  name: t.string().min(1, o.required),
6
6
  type: t.enum(
7
7
  [
@@ -17,7 +17,8 @@ const i = t.object({
17
17
  e.SingleLineText,
18
18
  e.CustomObjectReference,
19
19
  e.Url,
20
- e.Color
20
+ e.Color,
21
+ e.RichText
21
22
  ],
22
23
  "Invalid type"
23
24
  ),
@@ -25,5 +26,5 @@ const i = t.object({
25
26
  quantity: t.enum(["single", "multiple"])
26
27
  });
27
28
  export {
28
- i as CustomFieldDetailsSchema
29
+ r as CustomFieldDetailsSchema
29
30
  };
@@ -38,7 +38,7 @@ import { CustomFieldPreviewContainer as L } from "./shared/preview/custom-field-
38
38
  import F from "../../../../node_modules/lucide-react/dist/esm/icons/pipette.js";
39
39
  import j from "../../../../node_modules/lucide-react/dist/esm/icons/x.js";
40
40
  const gr = ({ onChange: a, definition: m, defaultValues: p }) => {
41
- const d = N(), { items: s, build: u, append: n, remove: h, reset: g, update: v } = z(p ?? [""]), [f, C] = k(
41
+ const d = N(), { items: s, build: u, append: n, remove: h, reset: g, update: f } = z(p ?? [""]), [v, C] = k(
42
42
  p?.map((i) => u(i)) ?? []
43
43
  );
44
44
  return /* @__PURE__ */ t(
@@ -53,7 +53,7 @@ const gr = ({ onChange: a, definition: m, defaultValues: p }) => {
53
53
  children: [
54
54
  /* @__PURE__ */ t("div", { className: "group grid grid-cols-1 items-center gap-2 md:grid-cols-[25%_1fr] md:gap-4 cursor-default", children: [
55
55
  /* @__PURE__ */ r(c, { htmlFor: d, className: "w-full", children: m.name }),
56
- /* @__PURE__ */ r(P, { asChild: !0, children: /* @__PURE__ */ r(L, { className: "px-2", children: f.map((i) => /* @__PURE__ */ r("div", { className: "w-5 h-5 rounded shrink-0", style: { backgroundColor: i.value } })) }) })
56
+ /* @__PURE__ */ r(P, { asChild: !0, children: /* @__PURE__ */ r(L, { className: "px-2", children: v.map((i) => /* @__PURE__ */ r("div", { className: "w-5 h-5 rounded shrink-0", style: { backgroundColor: i.value } })) }) })
57
57
  ] }),
58
58
  /* @__PURE__ */ r(b, { className: "w-auto min-w-72 max-w-lg", align: "start", children: /* @__PURE__ */ t("div", { className: "flex flex-col gap-2", children: [
59
59
  /* @__PURE__ */ r(c, { children: m.name }),
@@ -65,7 +65,7 @@ const gr = ({ onChange: a, definition: m, defaultValues: p }) => {
65
65
  style: { backgroundColor: i.value || "#000" }
66
66
  }
67
67
  ),
68
- /* @__PURE__ */ r(y, { onChange: (o) => v(i.id, o), children: /* @__PURE__ */ t(l, { size: "sm", variant: "outline", children: [
68
+ /* @__PURE__ */ r(y, { onChange: (o) => f(i.id, o), children: /* @__PURE__ */ t(l, { size: "sm", variant: "outline", children: [
69
69
  /* @__PURE__ */ r(F, { size: 16 }),
70
70
  "Pick color"
71
71
  ] }) }),
@@ -1,94 +1,102 @@
1
- import { jsx as t } from "react/jsx-runtime";
1
+ import { jsx as p } from "react/jsx-runtime";
2
2
  import { CustomFieldType as o } from "../../../api/codegen/graphql.js";
3
3
  import { BooleanCustomField as C } from "./boolean.js";
4
4
  import { ColorCustomField as u } from "./color.js";
5
5
  import { CustomObjectReferenceCustomField as F } from "./custom-object.js";
6
- import { DateCustomField as y } from "./date.js";
7
- import { DecimalCustomField as c } from "./decimal.js";
6
+ import { DateCustomField as c } from "./date.js";
7
+ import { DecimalCustomField as y } from "./decimal.js";
8
8
  import { ImageCustomField as l } from "./image.js";
9
- import { IntegerCustomField as g } from "./integer.js";
10
- import { MultiLineTextCustomField as s } from "./multi-line-text.js";
11
- import { ProductReferenceCustomField as x } from "./product-reference.js";
12
- import { SingleLineTextCustomField as T } from "./single-line-text.js";
9
+ import { IntegerCustomField as x } from "./integer.js";
10
+ import { MultiLineTextCustomField as g } from "./multi-line-text.js";
11
+ import { ProductReferenceCustomField as s } from "./product-reference.js";
12
+ import { RichTextCustomField as T } from "./rich-text.js";
13
+ import { SingleLineTextCustomField as R } from "./single-line-text.js";
13
14
  import { UrlCustomField as D } from "./url.js";
14
- const q = ({ defaultValues: e, definition: r, onChange: p }) => r.type === o.SingleLineText ? /* @__PURE__ */ t(
15
- T,
15
+ const w = ({ defaultValues: e, definition: r, onChange: t }) => r.type === o.SingleLineText ? /* @__PURE__ */ p(
16
+ R,
16
17
  {
17
18
  defaultValues: e,
18
- onChange: (m) => p(r, m),
19
+ onChange: (m) => t(r, m),
19
20
  definition: r
20
21
  }
21
- ) : r.type === o.MultiLineText ? /* @__PURE__ */ t(
22
- s,
22
+ ) : r.type === o.MultiLineText ? /* @__PURE__ */ p(
23
+ g,
24
+ {
25
+ defaultValue: e?.[0],
26
+ onChange: (m) => t(r, m),
27
+ definition: r
28
+ }
29
+ ) : r.type === o.RichText ? /* @__PURE__ */ p(
30
+ T,
23
31
  {
24
32
  defaultValue: e?.[0],
25
- onChange: (m) => p(r, m),
33
+ onChange: (m) => t(r, m),
26
34
  definition: r
27
35
  }
28
- ) : r.type === o.Url ? /* @__PURE__ */ t(
36
+ ) : r.type === o.Url ? /* @__PURE__ */ p(
29
37
  D,
30
38
  {
31
39
  defaultValues: e,
32
- onChange: (m) => p(r, m),
40
+ onChange: (m) => t(r, m),
33
41
  definition: r
34
42
  }
35
- ) : r.type === o.Color ? /* @__PURE__ */ t(
43
+ ) : r.type === o.Color ? /* @__PURE__ */ p(
36
44
  u,
37
45
  {
38
46
  defaultValues: e,
39
- onChange: (m) => p(r, m),
47
+ onChange: (m) => t(r, m),
40
48
  definition: r
41
49
  }
42
- ) : r.type === o.Integer ? /* @__PURE__ */ t(
43
- g,
50
+ ) : r.type === o.Integer ? /* @__PURE__ */ p(
51
+ x,
44
52
  {
45
53
  defaultValues: e,
46
- onChange: (m) => p(r, m),
54
+ onChange: (m) => t(r, m),
47
55
  definition: r
48
56
  }
49
- ) : r.type === o.Decimal ? /* @__PURE__ */ t(
50
- c,
57
+ ) : r.type === o.Decimal ? /* @__PURE__ */ p(
58
+ y,
51
59
  {
52
60
  defaultValues: e,
53
- onChange: (m) => p(r, m),
61
+ onChange: (m) => t(r, m),
54
62
  definition: r
55
63
  }
56
- ) : r.type === o.Boolean ? /* @__PURE__ */ t(
64
+ ) : r.type === o.Boolean ? /* @__PURE__ */ p(
57
65
  C,
58
66
  {
59
67
  defaultValues: e,
60
- onChange: (m) => p(r, m),
68
+ onChange: (m) => t(r, m),
61
69
  definition: r
62
70
  }
63
- ) : r.type === o.Date ? /* @__PURE__ */ t(
64
- y,
71
+ ) : r.type === o.Date ? /* @__PURE__ */ p(
72
+ c,
65
73
  {
66
74
  defaultValues: e,
67
- onChange: (m) => p(r, m),
75
+ onChange: (m) => t(r, m),
68
76
  definition: r
69
77
  }
70
- ) : r.type === o.Image ? /* @__PURE__ */ t(
78
+ ) : r.type === o.Image ? /* @__PURE__ */ p(
71
79
  l,
72
80
  {
73
81
  defaultValues: e,
74
- onChange: (m) => p(r, m),
82
+ onChange: (m) => t(r, m),
75
83
  definition: r
76
84
  }
77
- ) : r.type === o.ProductReference ? /* @__PURE__ */ t(
78
- x,
85
+ ) : r.type === o.ProductReference ? /* @__PURE__ */ p(
86
+ s,
79
87
  {
80
88
  defaultValues: e,
81
- onChange: (m) => p(r, m),
89
+ onChange: (m) => t(r, m),
82
90
  definition: r
83
91
  }
84
- ) : r.type === o.CustomObjectReference ? /* @__PURE__ */ t(
92
+ ) : r.type === o.CustomObjectReference ? /* @__PURE__ */ p(
85
93
  F,
86
94
  {
87
95
  defaultValues: e,
88
- onChange: (m) => p(r, m),
96
+ onChange: (m) => t(r, m),
89
97
  definition: r
90
98
  }
91
99
  ) : null;
92
100
  export {
93
- q as CustomField
101
+ w as CustomField
94
102
  };
@@ -0,0 +1,8 @@
1
+ import { CommonCustomFieldDefinitionFragment } from '../../../api/types';
2
+ export declare const RichTextCustomField: ({ defaultValue, definition, onChange }: Props) => import("react/jsx-runtime").JSX.Element;
3
+ type Props = {
4
+ defaultValue?: string;
5
+ onChange: (value: null | string) => void;
6
+ definition: CommonCustomFieldDefinitionFragment;
7
+ };
8
+ export {};
@@ -0,0 +1,17 @@
1
+ import { jsx as n } from "react/jsx-runtime";
2
+ import { PrimitiveCustomField as s } from "./shared/primitive.js";
3
+ const a = ({ defaultValue: t, definition: e, onChange: o }) => /* @__PURE__ */ n(
4
+ s,
5
+ {
6
+ richtext: !0,
7
+ defaultValues: t ? [t] : [""],
8
+ definition: e,
9
+ onChange: (r) => {
10
+ const i = r.map((m) => m.value);
11
+ o(i[0] ?? null);
12
+ }
13
+ }
14
+ );
15
+ export {
16
+ a as RichTextCustomField
17
+ };
@@ -1,6 +1,6 @@
1
1
  import { ComponentProps } from 'react';
2
2
  import { CommonCustomFieldDefinitionFragment } from '../../../../api/types';
3
- export declare const PrimitiveCustomField: ({ onChange, definition, placeholder, defaultValues, inputProps, mapOnSave, textarea, bool, date }: Props) => import("react/jsx-runtime").JSX.Element;
3
+ export declare const PrimitiveCustomField: ({ onChange, definition, placeholder, defaultValues, inputProps, mapOnSave, textarea, bool, date, richtext }: Props) => import("react/jsx-runtime").JSX.Element;
4
4
  type Props = {
5
5
  definition: CommonCustomFieldDefinitionFragment;
6
6
  onChange: (items: {
@@ -13,6 +13,7 @@ type Props = {
13
13
  textarea?: boolean;
14
14
  bool?: boolean;
15
15
  date?: boolean;
16
+ richtext?: boolean;
16
17
  mapOnSave?: (items: {
17
18
  id: string;
18
19
  value: string;
@@ -1,26 +1,26 @@
1
1
  import { jsxs as l, jsx as r } from "react/jsx-runtime";
2
- import { useId as I, useState as L } from "react";
3
- import { isTruthy as C } from "../../../../../packages/lune-common/dist/index.js";
2
+ import { useId as F, useState as I } from "react";
3
+ import { isTruthy as w } from "../../../../../packages/lune-common/dist/index.js";
4
4
  import "../../../../../packages/lune-ui/dist/node_modules/@radix-ui/react-accordion/dist/index.js";
5
5
  import { cn as z } from "../../../../../packages/lune-ui/dist/lib/utils.js";
6
6
  import "../../../../../packages/lune-ui/dist/node_modules/@radix-ui/react-alert-dialog/dist/index.js";
7
- import { Button as p } from "../../../../../packages/lune-ui/dist/components/button.js";
7
+ import { Button as u } from "../../../../../packages/lune-ui/dist/components/button.js";
8
8
  import "../../../../../packages/lune-ui/dist/node_modules/@radix-ui/react-avatar/dist/index.js";
9
9
  import "../../../../../packages/lune-ui/dist/node_modules/@radix-ui/react-separator/dist/index.js";
10
- import { Calendar as F } from "../../../../../packages/lune-ui/dist/components/calendar.js";
10
+ import { Calendar as E } from "../../../../../packages/lune-ui/dist/components/calendar.js";
11
11
  import "../../../../../packages/lune-ui/dist/components/chart.js";
12
12
  import "../../../../../packages/lune-ui/dist/node_modules/@radix-ui/react-checkbox/dist/index.js";
13
13
  import "../../../../../packages/lune-ui/dist/node_modules/@radix-ui/react-collapsible/dist/index.js";
14
14
  import "../../../../../packages/lune-ui/dist/node_modules/cmdk/dist/index.js";
15
15
  import "../../../../../packages/lune-ui/dist/components/dialog.js";
16
16
  import "../../../../../packages/lune-ui/dist/node_modules/@radix-ui/react-dropdown-menu/dist/index.js";
17
- import { Input as w } from "../../../../../packages/lune-ui/dist/components/input.js";
18
- import { Textarea as O } from "../../../../../packages/lune-ui/dist/components/textarea.js";
19
- import { Label as N } from "../../../../../packages/lune-ui/dist/components/label.js";
17
+ import { Input as N } from "../../../../../packages/lune-ui/dist/components/input.js";
18
+ import { Textarea as M } from "../../../../../packages/lune-ui/dist/components/textarea.js";
19
+ import { Label as P } from "../../../../../packages/lune-ui/dist/components/label.js";
20
20
  import "../../../../../packages/lune-ui/dist/components/phone-input.js";
21
- import { Popover as P, PopoverTrigger as x, PopoverContent as S } from "../../../../../packages/lune-ui/dist/components/popover.js";
21
+ import { Popover as x, PopoverTrigger as S, PopoverContent as j } from "../../../../../packages/lune-ui/dist/components/popover.js";
22
22
  import "../../../../../packages/lune-ui/dist/node_modules/@radix-ui/react-radio-group/dist/index.js";
23
- import { Select as $, SelectTrigger as B, SelectValue as G, SelectContent as M, SelectItem as j } from "../../../../../packages/lune-ui/dist/components/select.js";
23
+ import { Select as O, SelectTrigger as R, SelectValue as $, SelectContent as B, SelectItem as T } from "../../../../../packages/lune-ui/dist/components/select.js";
24
24
  import "../../../../../packages/lune-ui/dist/node_modules/@radix-ui/react-dialog/dist/index.js";
25
25
  import "../../../../../packages/lune-ui/dist/node_modules/@radix-ui/react-switch/dist/index.js";
26
26
  import "../../../../../packages/lune-ui/dist/node_modules/@radix-ui/react-tabs/dist/index.js";
@@ -30,69 +30,75 @@ import "../../../../../packages/lune-ui/dist/node_modules/@radix-ui/react-toggle
30
30
  import "../../../../../packages/lune-ui/dist/components/toggle-group.js";
31
31
  import "../../../../../packages/lune-ui/dist/node_modules/@radix-ui/react-tooltip/dist/index.js";
32
32
  import "../../../../../packages/lune-ui/dist/form/form.js";
33
- import { useList as R } from "../../../../../shared/hooks/use-list.js";
34
- import { formatDate as T } from "../../../../../node_modules/date-fns/format.js";
35
- import U from "../../../../../node_modules/lucide-react/dist/esm/icons/calendar.js";
36
- import X from "../../../../../node_modules/lucide-react/dist/esm/icons/x.js";
37
- const ke = ({
33
+ import { RichEditor as G } from "../../../../../shared/components/rich-editor/rich-editor.js";
34
+ import { useList as H } from "../../../../../shared/hooks/use-list.js";
35
+ import { CustomFieldPreviewContainer as U } from "./preview/custom-field-preview-container.js";
36
+ import { formatDate as V } from "../../../../../node_modules/date-fns/format.js";
37
+ import X from "../../../../../node_modules/lucide-react/dist/esm/icons/calendar.js";
38
+ import _ from "../../../../../node_modules/lucide-react/dist/esm/icons/x.js";
39
+ const Ae = ({
38
40
  onChange: k,
39
- definition: n,
40
- placeholder: t,
41
- defaultValues: u,
41
+ definition: s,
42
+ placeholder: i,
43
+ defaultValues: c,
42
44
  inputProps: y,
43
- mapOnSave: c,
44
- textarea: d,
45
- bool: v,
46
- date: h
45
+ mapOnSave: d,
46
+ textarea: v,
47
+ bool: h,
48
+ date: f,
49
+ richtext: m
47
50
  }) => {
48
- const f = I(), { items: o, build: V, append: g, remove: b, reset: A, update: i } = R(u ?? [""]), [s, D] = L(
49
- u?.map((e) => V(e)) ?? []
51
+ const g = F(), { items: n, build: L, append: C, remove: b, reset: A, update: o } = H(c ?? [""]), [t, D] = I(
52
+ c?.map((e) => L(e)) ?? []
50
53
  );
51
54
  return /* @__PURE__ */ l(
52
- P,
55
+ x,
53
56
  {
54
57
  onOpenChange: (e) => {
55
58
  if (!e) {
56
- const a = c ? o.filter((m) => C(m.value)).map(c) : o.filter((m) => C(m.value));
57
- D(a), k(a), A(a), a.length || g("");
59
+ const a = d ? n.filter((p) => w(p.value)).map(d) : n.filter((p) => w(p.value));
60
+ D(a), k(a), A(a), a.length || C("");
58
61
  }
59
62
  },
60
63
  children: [
61
64
  /* @__PURE__ */ l("div", { className: "group grid grid-cols-1 items-center gap-2 md:grid-cols-[25%_1fr] md:gap-4 cursor-default", children: [
62
- /* @__PURE__ */ r(N, { htmlFor: f, className: "w-full", children: n.name }),
63
- /* @__PURE__ */ r(x, { asChild: !0, children: /* @__PURE__ */ r(
64
- w,
65
+ /* @__PURE__ */ r(P, { htmlFor: g, className: "w-full", children: s.name }),
66
+ /* @__PURE__ */ r(S, { asChild: !0, children: m ? /* @__PURE__ */ r(U, { className: "px-2", children: t.map((e) => {
67
+ const a = document.createElement("div");
68
+ return a.innerHTML = e.value, a.textContent;
69
+ }) }) : /* @__PURE__ */ r(
70
+ N,
65
71
  {
66
- id: f,
67
- value: d ? s.map((e) => e.value).join(", ").replaceAll(`
68
- `, " ") : v ? s.map(
72
+ id: g,
73
+ value: m ? t.map((e) => e.value).join(", ") : v ? t.map((e) => e.value).join(", ").replaceAll(`
74
+ `, " ") : h ? t.map(
69
75
  (e) => `${e.value.charAt(0).toUpperCase()}${e.value.slice(1, e.value.length)}`
70
76
  ).join(", ").replaceAll(`
71
- `, " ") : h ? s.map((e) => e.value ? T(e.value, "PPP") : "").join(", ") : s.map((e) => e.value).join(", "),
77
+ `, " ") : f ? t.map((e) => e.value ? V(e.value, "PPP") : "").join(", ") : t.map((e) => e.value).join(", "),
72
78
  readOnly: !0,
73
79
  className: "w-full shrink-0 text-start dark:group-hover:bg-input/50 group-hover:bg-muted"
74
80
  }
75
81
  ) })
76
82
  ] }),
77
- /* @__PURE__ */ r(S, { className: "w-auto min-w-72 max-w-lg", align: "start", children: /* @__PURE__ */ l("div", { className: "flex flex-col gap-2", children: [
78
- /* @__PURE__ */ r(N, { children: n.name }),
79
- o.map((e) => /* @__PURE__ */ l("div", { className: "flex items-center gap-2", children: [
80
- d ? /* @__PURE__ */ r(
81
- O,
83
+ /* @__PURE__ */ r(j, { className: "w-auto min-w-72 max-w-lg", align: "start", children: /* @__PURE__ */ l("div", { className: "flex flex-col gap-2", children: [
84
+ /* @__PURE__ */ r(P, { children: s.name }),
85
+ n.map((e) => /* @__PURE__ */ l("div", { className: "flex items-center gap-2", children: [
86
+ m ? /* @__PURE__ */ r(G, { defaultValue: e.value, onChange: (a) => o(e.id, a) }) : v ? /* @__PURE__ */ r(
87
+ M,
82
88
  {
83
- placeholder: t,
89
+ placeholder: i,
84
90
  value: e.value,
85
- onChange: (a) => i(e.id, a.target.value)
91
+ onChange: (a) => o(e.id, a.target.value)
86
92
  }
87
- ) : v ? /* @__PURE__ */ l($, { value: e.value, onValueChange: (a) => i(e.id, a), children: [
88
- /* @__PURE__ */ r(B, { children: /* @__PURE__ */ r(G, { placeholder: t || "Select a value" }) }),
89
- /* @__PURE__ */ l(M, { children: [
90
- /* @__PURE__ */ r(j, { value: "true", children: "True" }),
91
- /* @__PURE__ */ r(j, { value: "false", children: "False" })
93
+ ) : h ? /* @__PURE__ */ l(O, { value: e.value, onValueChange: (a) => o(e.id, a), children: [
94
+ /* @__PURE__ */ r(R, { children: /* @__PURE__ */ r($, { placeholder: i || "Select a value" }) }),
95
+ /* @__PURE__ */ l(B, { children: [
96
+ /* @__PURE__ */ r(T, { value: "true", children: "True" }),
97
+ /* @__PURE__ */ r(T, { value: "false", children: "False" })
92
98
  ] })
93
- ] }) : h ? /* @__PURE__ */ l(P, { children: [
94
- /* @__PURE__ */ r(x, { asChild: !0, children: /* @__PURE__ */ l(
95
- p,
99
+ ] }) : f ? /* @__PURE__ */ l(x, { children: [
100
+ /* @__PURE__ */ r(S, { asChild: !0, children: /* @__PURE__ */ l(
101
+ u,
96
102
  {
97
103
  variant: "outline",
98
104
  className: z(
@@ -100,47 +106,47 @@ const ke = ({
100
106
  !e.value && "text-muted-foreground"
101
107
  ),
102
108
  children: [
103
- e.value ? T(new Date(e.value), "PPP") : /* @__PURE__ */ r("span", { children: t }),
104
- /* @__PURE__ */ r(U, { size: 16, className: "opacity-50" })
109
+ e.value ? V(new Date(e.value), "PPP") : /* @__PURE__ */ r("span", { children: i }),
110
+ /* @__PURE__ */ r(X, { size: 16, className: "opacity-50" })
105
111
  ]
106
112
  }
107
113
  ) }),
108
- /* @__PURE__ */ r(S, { className: "w-auto p-0", align: "start", children: /* @__PURE__ */ r(
109
- F,
114
+ /* @__PURE__ */ r(j, { className: "w-auto p-0", align: "start", children: /* @__PURE__ */ r(
115
+ E,
110
116
  {
111
117
  mode: "single",
112
118
  defaultMonth: e.value ? new Date(e.value) : void 0,
113
119
  selected: e.value ? new Date(e.value) : void 0,
114
- onSelect: (a) => i(e.id, a ? a.toISOString() : ""),
120
+ onSelect: (a) => o(e.id, a ? a.toISOString() : ""),
115
121
  className: "h-81.25"
116
122
  }
117
123
  ) })
118
124
  ] }) : /* @__PURE__ */ r(
119
- w,
125
+ N,
120
126
  {
121
127
  ...y,
122
128
  value: e.value,
123
- placeholder: t,
124
- onChange: (a) => i(e.id, a.target.value)
129
+ placeholder: i,
130
+ onChange: (a) => o(e.id, a.target.value)
125
131
  }
126
132
  ),
127
- o.length > 1 && /* @__PURE__ */ r(
128
- p,
133
+ n.length > 1 && /* @__PURE__ */ r(
134
+ u,
129
135
  {
130
136
  variant: "ghost",
131
137
  size: "icon",
132
138
  onClick: () => b(e.id),
133
139
  className: "shrink-0",
134
- children: /* @__PURE__ */ r(X, {})
140
+ children: /* @__PURE__ */ r(_, {})
135
141
  }
136
142
  )
137
143
  ] }, e.id)),
138
- n.isList && /* @__PURE__ */ r(p, { variant: "outline", size: "sm", onClick: () => g(""), className: "w-fit", children: "Add item" })
144
+ s.isList && /* @__PURE__ */ r(u, { variant: "outline", size: "sm", onClick: () => C(""), className: "w-fit", children: "Add item" })
139
145
  ] }) })
140
146
  ]
141
147
  }
142
148
  );
143
149
  };
144
150
  export {
145
- ke as PrimitiveCustomField
151
+ Ae as PrimitiveCustomField
146
152
  };