@rulab/adminjs-components 0.0.6 → 0.0.8

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.
package/dist/index.cjs CHANGED
@@ -32,6 +32,7 @@ var src_exports = {};
32
32
  __export(src_exports, {
33
33
  CustomSlug: () => CustomSlug_default,
34
34
  Editor: () => Editor_default,
35
+ EditorList: () => EditorList_default,
35
36
  EditorShow: () => EditorShow_default,
36
37
  StringList: () => StringList_default,
37
38
  StringListShow: () => StringListShow_default
@@ -72,6 +73,11 @@ var StyledCustomInput = (0, import_styled_components.styled)(import_design_syste
72
73
  var StyledGenerateButton = (0, import_styled_components.styled)(import_design_system.Button)`
73
74
  white-space: nowrap;
74
75
  `;
76
+ var StyledLabel = import_styled_components.styled.div`
77
+ font-size: 12px;
78
+ margin-bottom: 8px;
79
+ text-transform: capitalize;
80
+ `;
75
81
 
76
82
  // src/components/CustomSlug/CustomSlug.tsx
77
83
  var CustomSlug = ({ property, record, onChange }) => {
@@ -79,7 +85,7 @@ var CustomSlug = ({ property, record, onChange }) => {
79
85
  (0, import_react.useEffect)(() => {
80
86
  onChange(property.path, inputValue);
81
87
  }, [inputValue]);
82
- return /* @__PURE__ */ import_react.default.createElement(import_styled_components2.ThemeProvider, { theme: import_design_system2.theme }, /* @__PURE__ */ import_react.default.createElement(import_design_system2.Label, { htmlFor: "customSlug" }, "Slug"), /* @__PURE__ */ import_react.default.createElement(StyledInputWrapper, null, /* @__PURE__ */ import_react.default.createElement(
88
+ return /* @__PURE__ */ import_react.default.createElement(import_styled_components2.ThemeProvider, { theme: import_design_system2.theme }, /* @__PURE__ */ import_react.default.createElement(StyledLabel, { htmlFor: "customSlug" }, property.path), /* @__PURE__ */ import_react.default.createElement(StyledInputWrapper, null, /* @__PURE__ */ import_react.default.createElement(
83
89
  StyledCustomInput,
84
90
  {
85
91
  id: property.path,
@@ -102,13 +108,13 @@ var CustomSlug = ({ property, record, onChange }) => {
102
108
  var CustomSlug_default = CustomSlug;
103
109
 
104
110
  // src/components/StringList/StringList.tsx
111
+ var import_design_system5 = require("@adminjs/design-system");
105
112
  var import_react5 = __toESM(require("react"), 1);
106
113
  var import_styled_components6 = require("styled-components");
107
- var import_design_system5 = require("@adminjs/design-system");
108
114
 
109
115
  // src/components/StringList/styles.ts
110
- var import_styled_components3 = require("@adminjs/design-system/styled-components");
111
116
  var import_design_system3 = require("@adminjs/design-system");
117
+ var import_styled_components3 = require("@adminjs/design-system/styled-components");
112
118
  var StyledWrapper = (0, import_styled_components3.styled)(import_design_system3.Box)`
113
119
  display: flex;
114
120
  flex-direction: column;
@@ -124,17 +130,20 @@ var StyledInputWrapper2 = (0, import_styled_components3.styled)(import_design_sy
124
130
  var StyledListWrapper = (0, import_styled_components3.styled)(import_design_system3.Box)`
125
131
  margin-bottom: 15px;
126
132
  `;
127
- var StringListShowLabel = import_styled_components3.styled.div`
133
+ var StyledLabel2 = import_styled_components3.styled.div`
128
134
  font-size: 12px;
129
135
  margin-bottom: 8px;
130
136
  text-transform: capitalize;
137
+ `;
138
+ var StyledShowLabel = (0, import_styled_components3.styled)(StyledLabel2)`
131
139
  line-height: 16px;
132
140
  color: rgb(137, 138, 154);
141
+ font-weight: 300;
133
142
  `;
134
- var StringListShowWrapper = (0, import_styled_components3.styled)(import_design_system3.Box)`
143
+ var StyledShowWrapper = (0, import_styled_components3.styled)(import_design_system3.Box)`
135
144
  margin-bottom: 35px;
136
145
  `;
137
- var ListItem = import_styled_components3.styled.li`
146
+ var StyledListItem = import_styled_components3.styled.li`
138
147
  margin-bottom: 5px;
139
148
  `;
140
149
 
@@ -153,7 +162,7 @@ var import_react2 = __toESM(require("react"), 1);
153
162
 
154
163
  // src/components/StringList/SortableList/components/SortableItem/styles.ts
155
164
  var import_styled_components4 = require("@adminjs/design-system/styled-components");
156
- var StyledListItem = import_styled_components4.styled.li`
165
+ var StyledListItem2 = import_styled_components4.styled.li`
157
166
  display: flex;
158
167
  justify-content: space-between;
159
168
  align-items: center;
@@ -165,7 +174,7 @@ var StyledListItem = import_styled_components4.styled.li`
165
174
  border-radius: 5px;
166
175
  list-style: none;
167
176
  `;
168
- var DragButton = import_styled_components4.styled.button`
177
+ var StyledDragButton = import_styled_components4.styled.button`
169
178
  padding: 3px;
170
179
  margin-right: 15px;
171
180
  cursor: move;
@@ -176,7 +185,7 @@ var DragButton = import_styled_components4.styled.button`
176
185
  // src/components/StringList/SortableList/components/SortableItem/DragHandle.tsx
177
186
  var DragHandle = ({ context }) => {
178
187
  const { attributes, listeners, ref } = (0, import_react2.useContext)(context);
179
- return /* @__PURE__ */ import_react2.default.createElement(DragButton, { ...attributes, ...listeners, ref }, /* @__PURE__ */ import_react2.default.createElement("svg", { viewBox: "0 0 20 20", width: "13" }, /* @__PURE__ */ import_react2.default.createElement("path", { d: "M7 2a2 2 0 1 0 .001 4.001A2 2 0 0 0 7 2zm0 6a2 2 0 1 0 .001 4.001A2 2 0 0 0 7 8zm0 6a2 2 0 1 0 .001 4.001A2 2 0 0 0 7 14zm6-8a2 2 0 1 0-.001-4.001A2 2 0 0 0 13 6zm0 2a2 2 0 1 0 .001 4.001A2 2 0 0 0 13 8zm0 6a2 2 0 1 0 .001 4.001A2 2 0 0 0 13 14z" })));
188
+ return /* @__PURE__ */ import_react2.default.createElement(StyledDragButton, { ...attributes, ...listeners, ref }, /* @__PURE__ */ import_react2.default.createElement("svg", { viewBox: "0 0 20 20", width: "13" }, /* @__PURE__ */ import_react2.default.createElement("path", { d: "M7 2a2 2 0 1 0 .001 4.001A2 2 0 0 0 7 2zm0 6a2 2 0 1 0 .001 4.001A2 2 0 0 0 7 8zm0 6a2 2 0 1 0 .001 4.001A2 2 0 0 0 7 14zm6-8a2 2 0 1 0-.001-4.001A2 2 0 0 0 13 6zm0 2a2 2 0 1 0 .001 4.001A2 2 0 0 0 13 8zm0 6a2 2 0 1 0 .001 4.001A2 2 0 0 0 13 14z" })));
180
189
  };
181
190
 
182
191
  // src/components/StringList/SortableList/components/SortableItem/SortableItem.tsx
@@ -203,7 +212,7 @@ function SortableItem({
203
212
  const style = {
204
213
  opacity: isDragging ? 0.4 : void 0
205
214
  };
206
- return /* @__PURE__ */ import_react3.default.createElement(SortableItemContext.Provider, { value: context }, /* @__PURE__ */ import_react3.default.createElement(StyledListItem, { ref: setNodeRef, style }, /* @__PURE__ */ import_react3.default.createElement("div", null, /* @__PURE__ */ import_react3.default.createElement(DragHandle, { context: SortableItemContext }), children), /* @__PURE__ */ import_react3.default.createElement(
215
+ return /* @__PURE__ */ import_react3.default.createElement(SortableItemContext.Provider, { value: context }, /* @__PURE__ */ import_react3.default.createElement(StyledListItem2, { ref: setNodeRef, style }, /* @__PURE__ */ import_react3.default.createElement("div", null, /* @__PURE__ */ import_react3.default.createElement(DragHandle, { context: SortableItemContext }), children), /* @__PURE__ */ import_react3.default.createElement(
207
216
  import_design_system4.Button,
208
217
  {
209
218
  variant: "outlined",
@@ -294,7 +303,7 @@ var StringList = ({
294
303
  (0, import_react5.useEffect)(() => {
295
304
  onChange(property.path, serializedData);
296
305
  }, [serializedData]);
297
- return /* @__PURE__ */ import_react5.default.createElement(import_styled_components6.ThemeProvider, { theme: import_design_system5.theme }, /* @__PURE__ */ import_react5.default.createElement(import_design_system5.Label, { htmlFor: "custom" }, "String List"), /* @__PURE__ */ import_react5.default.createElement(StyledWrapper, null, /* @__PURE__ */ import_react5.default.createElement(StyledListWrapper, null, /* @__PURE__ */ import_react5.default.createElement(
306
+ return /* @__PURE__ */ import_react5.default.createElement(import_styled_components6.ThemeProvider, { theme: import_design_system5.theme }, /* @__PURE__ */ import_react5.default.createElement(StyledLabel2, { htmlFor: "custom" }, property.path), /* @__PURE__ */ import_react5.default.createElement(StyledWrapper, null, /* @__PURE__ */ import_react5.default.createElement(StyledListWrapper, null, /* @__PURE__ */ import_react5.default.createElement(
298
307
  SortableList,
299
308
  {
300
309
  items: list,
@@ -363,7 +372,7 @@ var StringListShow = ({
363
372
  record,
364
373
  stringListSeparator = separator
365
374
  }) => {
366
- return /* @__PURE__ */ import_react6.default.createElement(import_styled_components7.ThemeProvider, { theme: import_design_system6.theme }, /* @__PURE__ */ import_react6.default.createElement(StringListShowWrapper, null, /* @__PURE__ */ import_react6.default.createElement(StringListShowLabel, null, property.name), record.params.facts && /* @__PURE__ */ import_react6.default.createElement("ul", null, record.params.facts.split(stringListSeparator).map((item, index) => /* @__PURE__ */ import_react6.default.createElement(ListItem, { key: index }, `- ${item}`)))));
375
+ return /* @__PURE__ */ import_react6.default.createElement(import_styled_components7.ThemeProvider, { theme: import_design_system6.theme }, /* @__PURE__ */ import_react6.default.createElement(StyledShowWrapper, null, /* @__PURE__ */ import_react6.default.createElement(StyledShowLabel, null, property.path), record.params.facts && /* @__PURE__ */ import_react6.default.createElement("ul", null, record.params.facts.split(stringListSeparator).map((item, index) => /* @__PURE__ */ import_react6.default.createElement(StyledListItem, { key: index }, `- ${item}`)))));
367
376
  };
368
377
  var StringListShow_default = StringListShow;
369
378
 
@@ -376,19 +385,21 @@ var import_design_system8 = require("@adminjs/design-system");
376
385
  // src/components/Editor/styles.ts
377
386
  var import_design_system7 = require("@adminjs/design-system");
378
387
  var import_styled_components8 = require("@adminjs/design-system/styled-components");
379
- var Label3 = import_styled_components8.styled.div`
388
+ var StyledLabel3 = import_styled_components8.styled.div`
380
389
  font-size: 12px;
381
390
  margin-bottom: 8px;
391
+ text-transform: capitalize;
392
+ `;
393
+ var StyledShowLabel2 = (0, import_styled_components8.styled)(StyledLabel3)`
382
394
  color: rgb(137, 138, 154);
395
+ font-weight: 300;
383
396
  `;
384
- var EditorWrapper = (0, import_styled_components8.styled)(import_design_system7.Box)`
397
+ var StyledEditorWrapper = (0, import_styled_components8.styled)(import_design_system7.Box)`
385
398
  padding: 12px;
386
399
  margin-bottom: 24px;
387
400
  border: 1px solid rgb(187, 195, 203);
388
401
  `;
389
- var EditorShowWrapper = (0, import_styled_components8.styled)(import_design_system7.Box)`
390
- margin-bottom: 24px;
391
-
402
+ var StyledEditorViewWrapper = (0, import_styled_components8.styled)(import_design_system7.Box)`
392
403
  h1,
393
404
  h2,
394
405
  h3 {
@@ -426,6 +437,9 @@ var EditorShowWrapper = (0, import_styled_components8.styled)(import_design_syst
426
437
  list-style: inherit;
427
438
  }
428
439
  `;
440
+ var StyledEditorShowWrapper = (0, import_styled_components8.styled)(StyledEditorViewWrapper)`
441
+ margin-bottom: 24px;
442
+ `;
429
443
  var StyledEditor = import_styled_components8.styled.div`
430
444
  .cdx-block,
431
445
  .ce-header {
@@ -519,7 +533,7 @@ var Editor = ({ property, record, onChangeAdmin, editorId }) => {
519
533
  ref?.current?.destroy?.();
520
534
  };
521
535
  }, []);
522
- return /* @__PURE__ */ import_react7.default.createElement(import_styled_components9.ThemeProvider, { theme: import_design_system8.theme }, /* @__PURE__ */ import_react7.default.createElement(Label3, null, "Text"), /* @__PURE__ */ import_react7.default.createElement(EditorWrapper, null, /* @__PURE__ */ import_react7.default.createElement(StyledEditor, { id: editorId })));
536
+ return /* @__PURE__ */ import_react7.default.createElement(import_styled_components9.ThemeProvider, { theme: import_design_system8.theme }, /* @__PURE__ */ import_react7.default.createElement(StyledLabel3, null, property.path), /* @__PURE__ */ import_react7.default.createElement(StyledEditorWrapper, null, /* @__PURE__ */ import_react7.default.createElement(StyledEditor, { id: editorId })));
523
537
  };
524
538
  var Editor_default = Editor;
525
539
 
@@ -543,13 +557,24 @@ var parseHtml = (jsonData) => {
543
557
  // src/components/Editor/EditorShow.jsx
544
558
  var EditorShow = ({ property, record }) => {
545
559
  const htmlContent = parseHtml(record.params[property.path]);
546
- return /* @__PURE__ */ import_react8.default.createElement(import_styled_components10.ThemeProvider, { theme: import_design_system9.theme }, /* @__PURE__ */ import_react8.default.createElement(EditorShowWrapper, null, /* @__PURE__ */ import_react8.default.createElement(Label3, null, "Content"), htmlContent && /* @__PURE__ */ import_react8.default.createElement("div", { dangerouslySetInnerHTML: { __html: String(htmlContent) } })));
560
+ return /* @__PURE__ */ import_react8.default.createElement(import_styled_components10.ThemeProvider, { theme: import_design_system9.theme }, /* @__PURE__ */ import_react8.default.createElement(StyledEditorShowWrapper, null, /* @__PURE__ */ import_react8.default.createElement(StyledShowLabel2, null, property.path), htmlContent && /* @__PURE__ */ import_react8.default.createElement("div", { dangerouslySetInnerHTML: { __html: htmlContent } })));
547
561
  };
548
562
  var EditorShow_default = EditorShow;
563
+
564
+ // src/components/Editor/EditorList.jsx
565
+ var import_react9 = __toESM(require("react"), 1);
566
+ var import_styled_components11 = require("styled-components");
567
+ var import_design_system10 = require("@adminjs/design-system");
568
+ var EditorList = ({ property, record }) => {
569
+ const htmlContent = parseHtml(record.params[property.path]);
570
+ return /* @__PURE__ */ import_react9.default.createElement(import_styled_components11.ThemeProvider, { theme: import_design_system10.theme }, /* @__PURE__ */ import_react9.default.createElement(StyledEditorViewWrapper, null, htmlContent && /* @__PURE__ */ import_react9.default.createElement("div", { dangerouslySetInnerHTML: { __html: htmlContent } })));
571
+ };
572
+ var EditorList_default = EditorList;
549
573
  // Annotate the CommonJS export names for ESM import in node:
550
574
  0 && (module.exports = {
551
575
  CustomSlug,
552
576
  Editor,
577
+ EditorList,
553
578
  EditorShow,
554
579
  StringList,
555
580
  StringListShow
package/dist/index.d.cts CHANGED
@@ -1,5 +1,5 @@
1
- import React, { FC } from 'react';
2
1
  import { EditPropertyProps, ShowPropertyProps } from 'adminjs';
2
+ import React, { FC } from 'react';
3
3
 
4
4
  type CustomSlugTypes = Omit<EditPropertyProps, "where" | "resource">;
5
5
  declare const CustomSlug: FC<CustomSlugTypes>;
@@ -27,4 +27,9 @@ declare function EditorShow({ property, record }: {
27
27
  record: any;
28
28
  }): React.JSX.Element;
29
29
 
30
- export { CustomSlug, Editor, EditorShow, StringList, StringListShow };
30
+ declare function EditorList({ property, record }: {
31
+ property: any;
32
+ record: any;
33
+ }): React.JSX.Element;
34
+
35
+ export { CustomSlug, Editor, EditorList, EditorShow, StringList, StringListShow };
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import React, { FC } from 'react';
2
1
  import { EditPropertyProps, ShowPropertyProps } from 'adminjs';
2
+ import React, { FC } from 'react';
3
3
 
4
4
  type CustomSlugTypes = Omit<EditPropertyProps, "where" | "resource">;
5
5
  declare const CustomSlug: FC<CustomSlugTypes>;
@@ -27,4 +27,9 @@ declare function EditorShow({ property, record }: {
27
27
  record: any;
28
28
  }): React.JSX.Element;
29
29
 
30
- export { CustomSlug, Editor, EditorShow, StringList, StringListShow };
30
+ declare function EditorList({ property, record }: {
31
+ property: any;
32
+ record: any;
33
+ }): React.JSX.Element;
34
+
35
+ export { CustomSlug, Editor, EditorList, EditorShow, StringList, StringListShow };
package/dist/index.js CHANGED
@@ -4,7 +4,7 @@ import React, {
4
4
  useState
5
5
  } from "react";
6
6
  import { ThemeProvider } from "styled-components";
7
- import { theme, Label } from "@adminjs/design-system";
7
+ import { theme } from "@adminjs/design-system";
8
8
 
9
9
  // src/utils/slugifyImport.ts
10
10
  import slugify from "slugify";
@@ -23,7 +23,7 @@ var slugifyTitle = (title) => {
23
23
 
24
24
  // src/components/CustomSlug/styles.ts
25
25
  import { styled } from "@adminjs/design-system/styled-components";
26
- import { Button, Box, Input } from "@adminjs/design-system";
26
+ import { Box, Button, Input } from "@adminjs/design-system";
27
27
  var StyledInputWrapper = styled(Box)`
28
28
  display: flex;
29
29
  margin-bottom: 40px;
@@ -35,6 +35,11 @@ var StyledCustomInput = styled(Input)`
35
35
  var StyledGenerateButton = styled(Button)`
36
36
  white-space: nowrap;
37
37
  `;
38
+ var StyledLabel = styled.div`
39
+ font-size: 12px;
40
+ margin-bottom: 8px;
41
+ text-transform: capitalize;
42
+ `;
38
43
 
39
44
  // src/components/CustomSlug/CustomSlug.tsx
40
45
  var CustomSlug = ({ property, record, onChange }) => {
@@ -42,7 +47,7 @@ var CustomSlug = ({ property, record, onChange }) => {
42
47
  useEffect(() => {
43
48
  onChange(property.path, inputValue);
44
49
  }, [inputValue]);
45
- return /* @__PURE__ */ React.createElement(ThemeProvider, { theme }, /* @__PURE__ */ React.createElement(Label, { htmlFor: "customSlug" }, "Slug"), /* @__PURE__ */ React.createElement(StyledInputWrapper, null, /* @__PURE__ */ React.createElement(
50
+ return /* @__PURE__ */ React.createElement(ThemeProvider, { theme }, /* @__PURE__ */ React.createElement(StyledLabel, { htmlFor: "customSlug" }, property.path), /* @__PURE__ */ React.createElement(StyledInputWrapper, null, /* @__PURE__ */ React.createElement(
46
51
  StyledCustomInput,
47
52
  {
48
53
  id: property.path,
@@ -65,16 +70,16 @@ var CustomSlug = ({ property, record, onChange }) => {
65
70
  var CustomSlug_default = CustomSlug;
66
71
 
67
72
  // src/components/StringList/StringList.tsx
73
+ import { Button as Button3, Input as Input3, theme as theme2 } from "@adminjs/design-system";
68
74
  import React5, {
69
- useState as useState3,
70
- useEffect as useEffect2
75
+ useEffect as useEffect2,
76
+ useState as useState3
71
77
  } from "react";
72
78
  import { ThemeProvider as ThemeProvider2 } from "styled-components";
73
- import { theme as theme2, Button as Button3, Input as Input3, Label as Label2 } from "@adminjs/design-system";
74
79
 
75
80
  // src/components/StringList/styles.ts
76
- import { styled as styled2 } from "@adminjs/design-system/styled-components";
77
81
  import { Box as Box2, Input as Input2 } from "@adminjs/design-system";
82
+ import { styled as styled2 } from "@adminjs/design-system/styled-components";
78
83
  var StyledWrapper = styled2(Box2)`
79
84
  display: flex;
80
85
  flex-direction: column;
@@ -90,17 +95,20 @@ var StyledInputWrapper2 = styled2(Box2)`
90
95
  var StyledListWrapper = styled2(Box2)`
91
96
  margin-bottom: 15px;
92
97
  `;
93
- var StringListShowLabel = styled2.div`
98
+ var StyledLabel2 = styled2.div`
94
99
  font-size: 12px;
95
100
  margin-bottom: 8px;
96
101
  text-transform: capitalize;
102
+ `;
103
+ var StyledShowLabel = styled2(StyledLabel2)`
97
104
  line-height: 16px;
98
105
  color: rgb(137, 138, 154);
106
+ font-weight: 300;
99
107
  `;
100
- var StringListShowWrapper = styled2(Box2)`
108
+ var StyledShowWrapper = styled2(Box2)`
101
109
  margin-bottom: 35px;
102
110
  `;
103
- var ListItem = styled2.li`
111
+ var StyledListItem = styled2.li`
104
112
  margin-bottom: 5px;
105
113
  `;
106
114
 
@@ -132,7 +140,7 @@ import React2, { useContext } from "react";
132
140
 
133
141
  // src/components/StringList/SortableList/components/SortableItem/styles.ts
134
142
  import { styled as styled3 } from "@adminjs/design-system/styled-components";
135
- var StyledListItem = styled3.li`
143
+ var StyledListItem2 = styled3.li`
136
144
  display: flex;
137
145
  justify-content: space-between;
138
146
  align-items: center;
@@ -144,7 +152,7 @@ var StyledListItem = styled3.li`
144
152
  border-radius: 5px;
145
153
  list-style: none;
146
154
  `;
147
- var DragButton = styled3.button`
155
+ var StyledDragButton = styled3.button`
148
156
  padding: 3px;
149
157
  margin-right: 15px;
150
158
  cursor: move;
@@ -155,7 +163,7 @@ var DragButton = styled3.button`
155
163
  // src/components/StringList/SortableList/components/SortableItem/DragHandle.tsx
156
164
  var DragHandle = ({ context }) => {
157
165
  const { attributes, listeners, ref } = useContext(context);
158
- return /* @__PURE__ */ React2.createElement(DragButton, { ...attributes, ...listeners, ref }, /* @__PURE__ */ React2.createElement("svg", { viewBox: "0 0 20 20", width: "13" }, /* @__PURE__ */ React2.createElement("path", { d: "M7 2a2 2 0 1 0 .001 4.001A2 2 0 0 0 7 2zm0 6a2 2 0 1 0 .001 4.001A2 2 0 0 0 7 8zm0 6a2 2 0 1 0 .001 4.001A2 2 0 0 0 7 14zm6-8a2 2 0 1 0-.001-4.001A2 2 0 0 0 13 6zm0 2a2 2 0 1 0 .001 4.001A2 2 0 0 0 13 8zm0 6a2 2 0 1 0 .001 4.001A2 2 0 0 0 13 14z" })));
166
+ return /* @__PURE__ */ React2.createElement(StyledDragButton, { ...attributes, ...listeners, ref }, /* @__PURE__ */ React2.createElement("svg", { viewBox: "0 0 20 20", width: "13" }, /* @__PURE__ */ React2.createElement("path", { d: "M7 2a2 2 0 1 0 .001 4.001A2 2 0 0 0 7 2zm0 6a2 2 0 1 0 .001 4.001A2 2 0 0 0 7 8zm0 6a2 2 0 1 0 .001 4.001A2 2 0 0 0 7 14zm6-8a2 2 0 1 0-.001-4.001A2 2 0 0 0 13 6zm0 2a2 2 0 1 0 .001 4.001A2 2 0 0 0 13 8zm0 6a2 2 0 1 0 .001 4.001A2 2 0 0 0 13 14z" })));
159
167
  };
160
168
 
161
169
  // src/components/StringList/SortableList/components/SortableItem/SortableItem.tsx
@@ -182,7 +190,7 @@ function SortableItem({
182
190
  const style = {
183
191
  opacity: isDragging ? 0.4 : void 0
184
192
  };
185
- return /* @__PURE__ */ React3.createElement(SortableItemContext.Provider, { value: context }, /* @__PURE__ */ React3.createElement(StyledListItem, { ref: setNodeRef, style }, /* @__PURE__ */ React3.createElement("div", null, /* @__PURE__ */ React3.createElement(DragHandle, { context: SortableItemContext }), children), /* @__PURE__ */ React3.createElement(
193
+ return /* @__PURE__ */ React3.createElement(SortableItemContext.Provider, { value: context }, /* @__PURE__ */ React3.createElement(StyledListItem2, { ref: setNodeRef, style }, /* @__PURE__ */ React3.createElement("div", null, /* @__PURE__ */ React3.createElement(DragHandle, { context: SortableItemContext }), children), /* @__PURE__ */ React3.createElement(
186
194
  Button2,
187
195
  {
188
196
  variant: "outlined",
@@ -273,7 +281,7 @@ var StringList = ({
273
281
  useEffect2(() => {
274
282
  onChange(property.path, serializedData);
275
283
  }, [serializedData]);
276
- return /* @__PURE__ */ React5.createElement(ThemeProvider2, { theme: theme2 }, /* @__PURE__ */ React5.createElement(Label2, { htmlFor: "custom" }, "String List"), /* @__PURE__ */ React5.createElement(StyledWrapper, null, /* @__PURE__ */ React5.createElement(StyledListWrapper, null, /* @__PURE__ */ React5.createElement(
284
+ return /* @__PURE__ */ React5.createElement(ThemeProvider2, { theme: theme2 }, /* @__PURE__ */ React5.createElement(StyledLabel2, { htmlFor: "custom" }, property.path), /* @__PURE__ */ React5.createElement(StyledWrapper, null, /* @__PURE__ */ React5.createElement(StyledListWrapper, null, /* @__PURE__ */ React5.createElement(
277
285
  SortableList,
278
286
  {
279
287
  items: list,
@@ -342,7 +350,7 @@ var StringListShow = ({
342
350
  record,
343
351
  stringListSeparator = separator
344
352
  }) => {
345
- return /* @__PURE__ */ React6.createElement(ThemeProvider3, { theme: theme3 }, /* @__PURE__ */ React6.createElement(StringListShowWrapper, null, /* @__PURE__ */ React6.createElement(StringListShowLabel, null, property.name), record.params.facts && /* @__PURE__ */ React6.createElement("ul", null, record.params.facts.split(stringListSeparator).map((item, index) => /* @__PURE__ */ React6.createElement(ListItem, { key: index }, `- ${item}`)))));
353
+ return /* @__PURE__ */ React6.createElement(ThemeProvider3, { theme: theme3 }, /* @__PURE__ */ React6.createElement(StyledShowWrapper, null, /* @__PURE__ */ React6.createElement(StyledShowLabel, null, property.path), record.params.facts && /* @__PURE__ */ React6.createElement("ul", null, record.params.facts.split(stringListSeparator).map((item, index) => /* @__PURE__ */ React6.createElement(StyledListItem, { key: index }, `- ${item}`)))));
346
354
  };
347
355
  var StringListShow_default = StringListShow;
348
356
 
@@ -355,19 +363,21 @@ import { theme as theme4 } from "@adminjs/design-system";
355
363
  // src/components/Editor/styles.ts
356
364
  import { Box as Box3 } from "@adminjs/design-system";
357
365
  import { styled as styled5 } from "@adminjs/design-system/styled-components";
358
- var Label3 = styled5.div`
366
+ var StyledLabel3 = styled5.div`
359
367
  font-size: 12px;
360
368
  margin-bottom: 8px;
369
+ text-transform: capitalize;
370
+ `;
371
+ var StyledShowLabel2 = styled5(StyledLabel3)`
361
372
  color: rgb(137, 138, 154);
373
+ font-weight: 300;
362
374
  `;
363
- var EditorWrapper = styled5(Box3)`
375
+ var StyledEditorWrapper = styled5(Box3)`
364
376
  padding: 12px;
365
377
  margin-bottom: 24px;
366
378
  border: 1px solid rgb(187, 195, 203);
367
379
  `;
368
- var EditorShowWrapper = styled5(Box3)`
369
- margin-bottom: 24px;
370
-
380
+ var StyledEditorViewWrapper = styled5(Box3)`
371
381
  h1,
372
382
  h2,
373
383
  h3 {
@@ -405,6 +415,9 @@ var EditorShowWrapper = styled5(Box3)`
405
415
  list-style: inherit;
406
416
  }
407
417
  `;
418
+ var StyledEditorShowWrapper = styled5(StyledEditorViewWrapper)`
419
+ margin-bottom: 24px;
420
+ `;
408
421
  var StyledEditor = styled5.div`
409
422
  .cdx-block,
410
423
  .ce-header {
@@ -498,12 +511,12 @@ var Editor = ({ property, record, onChangeAdmin, editorId }) => {
498
511
  ref?.current?.destroy?.();
499
512
  };
500
513
  }, []);
501
- return /* @__PURE__ */ React7.createElement(ThemeProvider4, { theme: theme4 }, /* @__PURE__ */ React7.createElement(Label3, null, "Text"), /* @__PURE__ */ React7.createElement(EditorWrapper, null, /* @__PURE__ */ React7.createElement(StyledEditor, { id: editorId })));
514
+ return /* @__PURE__ */ React7.createElement(ThemeProvider4, { theme: theme4 }, /* @__PURE__ */ React7.createElement(StyledLabel3, null, property.path), /* @__PURE__ */ React7.createElement(StyledEditorWrapper, null, /* @__PURE__ */ React7.createElement(StyledEditor, { id: editorId })));
502
515
  };
503
516
  var Editor_default = Editor;
504
517
 
505
518
  // src/components/Editor/EditorShow.jsx
506
- import React8, { memo as memo3, useState as useState6, useEffect as useEffect5, useRef as useRef3 } from "react";
519
+ import React8 from "react";
507
520
  import { ThemeProvider as ThemeProvider5 } from "styled-components";
508
521
  import { theme as theme5 } from "@adminjs/design-system";
509
522
 
@@ -522,12 +535,23 @@ var parseHtml = (jsonData) => {
522
535
  // src/components/Editor/EditorShow.jsx
523
536
  var EditorShow = ({ property, record }) => {
524
537
  const htmlContent = parseHtml(record.params[property.path]);
525
- return /* @__PURE__ */ React8.createElement(ThemeProvider5, { theme: theme5 }, /* @__PURE__ */ React8.createElement(EditorShowWrapper, null, /* @__PURE__ */ React8.createElement(Label3, null, "Content"), htmlContent && /* @__PURE__ */ React8.createElement("div", { dangerouslySetInnerHTML: { __html: String(htmlContent) } })));
538
+ return /* @__PURE__ */ React8.createElement(ThemeProvider5, { theme: theme5 }, /* @__PURE__ */ React8.createElement(StyledEditorShowWrapper, null, /* @__PURE__ */ React8.createElement(StyledShowLabel2, null, property.path), htmlContent && /* @__PURE__ */ React8.createElement("div", { dangerouslySetInnerHTML: { __html: htmlContent } })));
526
539
  };
527
540
  var EditorShow_default = EditorShow;
541
+
542
+ // src/components/Editor/EditorList.jsx
543
+ import React9 from "react";
544
+ import { ThemeProvider as ThemeProvider6 } from "styled-components";
545
+ import { theme as theme6 } from "@adminjs/design-system";
546
+ var EditorList = ({ property, record }) => {
547
+ const htmlContent = parseHtml(record.params[property.path]);
548
+ return /* @__PURE__ */ React9.createElement(ThemeProvider6, { theme: theme6 }, /* @__PURE__ */ React9.createElement(StyledEditorViewWrapper, null, htmlContent && /* @__PURE__ */ React9.createElement("div", { dangerouslySetInnerHTML: { __html: htmlContent } })));
549
+ };
550
+ var EditorList_default = EditorList;
528
551
  export {
529
552
  CustomSlug_default as CustomSlug,
530
553
  Editor_default as Editor,
554
+ EditorList_default as EditorList,
531
555
  EditorShow_default as EditorShow,
532
556
  StringList_default as StringList,
533
557
  StringListShow_default as StringListShow
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rulab/adminjs-components",
3
- "version": "0.0.6",
3
+ "version": "0.0.8",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/index.mjs",
6
6
  "types": "dist/index.d.ts",
@@ -1,3 +1,4 @@
1
+ import { EditPropertyProps } from "adminjs";
1
2
  import React, {
2
3
  ChangeEvent,
3
4
  FC,
@@ -6,16 +7,16 @@ import React, {
6
7
  useState,
7
8
  } from "react";
8
9
  import { ThemeProvider } from "styled-components";
9
- import { EditPropertyProps } from "adminjs";
10
10
 
11
- import { theme, Label } from "@adminjs/design-system";
11
+ import { theme } from "@adminjs/design-system";
12
12
 
13
13
  import { slugifyTitle } from "../../utils/index.js";
14
14
 
15
15
  import {
16
- StyledInputWrapper,
17
16
  StyledCustomInput,
18
17
  StyledGenerateButton,
18
+ StyledInputWrapper,
19
+ StyledLabel,
19
20
  } from "./styles.js";
20
21
 
21
22
  type CustomSlugTypes = Omit<EditPropertyProps, "where" | "resource">;
@@ -29,7 +30,7 @@ const CustomSlug: FC<CustomSlugTypes> = ({ property, record, onChange }) => {
29
30
 
30
31
  return (
31
32
  <ThemeProvider theme={theme}>
32
- <Label htmlFor="customSlug">Slug</Label>
33
+ <StyledLabel htmlFor="customSlug">{property.path}</StyledLabel>
33
34
  <StyledInputWrapper>
34
35
  <StyledCustomInput
35
36
  id={property.path}
@@ -1,7 +1,7 @@
1
1
  // @ts-ignore
2
2
  import { styled } from "@adminjs/design-system/styled-components";
3
3
  // @ts-ignore
4
- import { Button, Box, Input } from "@adminjs/design-system";
4
+ import { Box, Button, Input } from "@adminjs/design-system";
5
5
 
6
6
  export const StyledInputWrapper = styled(Box)`
7
7
  display: flex;
@@ -16,3 +16,9 @@ export const StyledCustomInput = styled(Input)`
16
16
  export const StyledGenerateButton = styled(Button)`
17
17
  white-space: nowrap;
18
18
  `;
19
+
20
+ export const StyledLabel = styled.div`
21
+ font-size: 12px;
22
+ margin-bottom: 8px;
23
+ text-transform: capitalize;
24
+ `;
@@ -3,7 +3,7 @@ import { ThemeProvider } from "styled-components";
3
3
  import EditorJS from "@editorjs/editorjs";
4
4
  import { theme } from "@adminjs/design-system";
5
5
 
6
- import { Label, StyledEditor, EditorWrapper } from "./styles";
6
+ import { StyledLabel, StyledEditor, StyledEditorWrapper } from "./styles";
7
7
 
8
8
  import { EDITOR_TOOLS } from "./config";
9
9
 
@@ -38,10 +38,10 @@ const Editor = ({ property, record, onChangeAdmin, editorId }) => {
38
38
 
39
39
  return (
40
40
  <ThemeProvider theme={theme}>
41
- <Label>Text</Label>
42
- <EditorWrapper>
41
+ <StyledLabel>{property.path}</StyledLabel>
42
+ <StyledEditorWrapper>
43
43
  <StyledEditor id={editorId} />
44
- </EditorWrapper>
44
+ </StyledEditorWrapper>
45
45
  </ThemeProvider>
46
46
  );
47
47
  };
@@ -0,0 +1,23 @@
1
+ import React from "react";
2
+ import { ThemeProvider } from "styled-components";
3
+ import { theme } from "@adminjs/design-system";
4
+
5
+ import { parseHtml } from "../../utils/parseHtml";
6
+
7
+ import { StyledEditorViewWrapper } from "./styles";
8
+
9
+ const EditorList = ({ property, record }) => {
10
+ const htmlContent = parseHtml(record.params[property.path]);
11
+
12
+ return (
13
+ <ThemeProvider theme={theme}>
14
+ <StyledEditorViewWrapper>
15
+ {htmlContent && (
16
+ <div dangerouslySetInnerHTML={{ __html: htmlContent }} />
17
+ )}
18
+ </StyledEditorViewWrapper>
19
+ </ThemeProvider>
20
+ );
21
+ };
22
+
23
+ export default EditorList;
@@ -1,24 +1,22 @@
1
- import React, { memo, useState, useEffect, useRef } from "react";
1
+ import React from "react";
2
2
  import { ThemeProvider } from "styled-components";
3
3
  import { theme } from "@adminjs/design-system";
4
4
 
5
5
  import { parseHtml } from "../../utils/parseHtml";
6
6
 
7
- import { EditorShowWrapper } from "./styles";
8
-
9
- import { Label } from "./styles";
7
+ import { StyledEditorShowWrapper, StyledShowLabel } from "./styles";
10
8
 
11
9
  const EditorShow = ({ property, record }) => {
12
10
  const htmlContent = parseHtml(record.params[property.path]);
13
11
 
14
12
  return (
15
13
  <ThemeProvider theme={theme}>
16
- <EditorShowWrapper>
17
- <Label>Content</Label>
14
+ <StyledEditorShowWrapper>
15
+ <StyledShowLabel>{property.path}</StyledShowLabel>
18
16
  {htmlContent && (
19
17
  <div dangerouslySetInnerHTML={{ __html: htmlContent }} />
20
18
  )}
21
- </EditorShowWrapper>
19
+ </StyledEditorShowWrapper>
22
20
  </ThemeProvider>
23
21
  );
24
22
  };
@@ -1,2 +1,3 @@
1
1
  export * from "./Editor.jsx";
2
2
  export * from "./EditorShow.jsx";
3
+ export * from "./EditorList.jsx";
@@ -1,21 +1,24 @@
1
1
  import { Box } from "@adminjs/design-system";
2
2
  import { styled } from "@adminjs/design-system/styled-components";
3
3
 
4
- export const Label = styled.div`
4
+ export const StyledLabel = styled.div`
5
5
  font-size: 12px;
6
6
  margin-bottom: 8px;
7
+ text-transform: capitalize;
8
+ `;
9
+
10
+ export const StyledShowLabel = styled(StyledLabel)`
7
11
  color: rgb(137, 138, 154);
12
+ font-weight: 300;
8
13
  `;
9
14
 
10
- export const EditorWrapper = styled(Box)`
15
+ export const StyledEditorWrapper = styled(Box)`
11
16
  padding: 12px;
12
17
  margin-bottom: 24px;
13
18
  border: 1px solid rgb(187, 195, 203);
14
19
  `;
15
20
 
16
- export const EditorShowWrapper = styled(Box)`
17
- margin-bottom: 24px;
18
-
21
+ export const StyledEditorViewWrapper = styled(Box)`
19
22
  h1,
20
23
  h2,
21
24
  h3 {
@@ -54,6 +57,10 @@ export const EditorShowWrapper = styled(Box)`
54
57
  }
55
58
  `;
56
59
 
60
+ export const StyledEditorShowWrapper = styled(StyledEditorViewWrapper)`
61
+ margin-bottom: 24px;
62
+ `;
63
+
57
64
  export const StyledEditor = styled.div`
58
65
  .cdx-block,
59
66
  .ce-header {
@@ -1,5 +1,5 @@
1
- import React, { Fragment, useMemo, useState } from 'react';
2
- import type { ReactNode } from 'react';
1
+ import React, { Fragment, useMemo, useState } from "react";
2
+ import type { ReactNode } from "react";
3
3
 
4
4
  import {
5
5
  DndContext,
@@ -9,20 +9,20 @@ import {
9
9
  useSensors,
10
10
  DragOverlay,
11
11
  defaultDropAnimationSideEffects,
12
- } from '@dnd-kit/core';
12
+ } from "@dnd-kit/core";
13
13
  import {
14
14
  SortableContext,
15
15
  arrayMove,
16
16
  sortableKeyboardCoordinates,
17
17
  verticalListSortingStrategy,
18
- } from '@dnd-kit/sortable';
18
+ } from "@dnd-kit/sortable";
19
19
 
20
- import type { DropAnimation } from '@dnd-kit/core';
20
+ import type { DropAnimation } from "@dnd-kit/core";
21
21
 
22
- import { DragHandle, SortableItem } from './components/index.js';
23
- import { StyledListWrapper } from './styles.js';
22
+ import { SortableItem } from "./components/index.js";
23
+ import { StyledListWrapper } from "./styles.js";
24
24
 
25
- import type { Active, UniqueIdentifier } from '@dnd-kit/core';
25
+ import type { Active, UniqueIdentifier } from "@dnd-kit/core";
26
26
 
27
27
  interface BaseItem {
28
28
  id: UniqueIdentifier;
@@ -39,7 +39,7 @@ const dropAnimationConfig: DropAnimation = {
39
39
  sideEffects: defaultDropAnimationSideEffects({
40
40
  styles: {
41
41
  active: {
42
- opacity: '0.4',
42
+ opacity: "0.4",
43
43
  },
44
44
  },
45
45
  }),
@@ -1,7 +1,7 @@
1
- import React, { Context, FC, useContext } from 'react';
1
+ import React, { Context, FC, useContext } from "react";
2
2
 
3
- import { DragButton } from './styles.js';
4
- import type { DragContext } from './types.js';
3
+ import { StyledDragButton } from "./styles.js";
4
+ import type { DragContext } from "./types.js";
5
5
 
6
6
  interface DragHandlePropsType {
7
7
  context: Context<DragContext>;
@@ -11,10 +11,10 @@ export const DragHandle: FC<DragHandlePropsType> = ({ context }) => {
11
11
  const { attributes, listeners, ref } = useContext(context);
12
12
 
13
13
  return (
14
- <DragButton {...attributes} {...listeners} ref={ref}>
14
+ <StyledDragButton {...attributes} {...listeners} ref={ref}>
15
15
  <svg viewBox="0 0 20 20" width="13">
16
16
  <path d="M7 2a2 2 0 1 0 .001 4.001A2 2 0 0 0 7 2zm0 6a2 2 0 1 0 .001 4.001A2 2 0 0 0 7 8zm0 6a2 2 0 1 0 .001 4.001A2 2 0 0 0 7 14zm6-8a2 2 0 1 0-.001-4.001A2 2 0 0 0 13 6zm0 2a2 2 0 1 0 .001 4.001A2 2 0 0 0 13 8zm0 6a2 2 0 1 0 .001 4.001A2 2 0 0 0 13 14z"></path>
17
17
  </svg>
18
- </DragButton>
18
+ </StyledDragButton>
19
19
  );
20
20
  };
@@ -1,4 +1,4 @@
1
- import { styled } from '@adminjs/design-system/styled-components';
1
+ import { styled } from "@adminjs/design-system/styled-components";
2
2
 
3
3
  export const StyledListItem = styled.li`
4
4
  display: flex;
@@ -13,7 +13,7 @@ export const StyledListItem = styled.li`
13
13
  list-style: none;
14
14
  `;
15
15
 
16
- export const DragButton = styled.button`
16
+ export const StyledDragButton = styled.button`
17
17
  padding: 3px;
18
18
  margin-right: 15px;
19
19
  cursor: move;
@@ -1,20 +1,21 @@
1
+ import { Button, Input, theme } from "@adminjs/design-system";
2
+ import { EditPropertyProps } from "adminjs";
1
3
  import React, {
2
- useState,
3
- useEffect,
4
4
  ChangeEvent,
5
+ FC,
5
6
  KeyboardEvent,
6
7
  SyntheticEvent,
7
- FC,
8
+ useEffect,
9
+ useState,
8
10
  } from "react";
9
11
  import { ThemeProvider } from "styled-components";
10
- import { EditPropertyProps } from "adminjs";
11
- import { theme, Button, Input, Label } from "@adminjs/design-system";
12
12
 
13
13
  import {
14
- StyledWrapper,
15
14
  StyledCustomInput,
16
- StyledListWrapper,
17
15
  StyledInputWrapper,
16
+ StyledLabel,
17
+ StyledListWrapper,
18
+ StyledWrapper,
18
19
  } from "./styles.js";
19
20
 
20
21
  import { SortableList } from "./SortableList/SortableList.js";
@@ -55,7 +56,7 @@ const StringList: FC<StringListShowPropsType> = ({
55
56
 
56
57
  return (
57
58
  <ThemeProvider theme={theme}>
58
- <Label htmlFor="custom">String List</Label>
59
+ <StyledLabel htmlFor="custom">{property.path}</StyledLabel>
59
60
  <StyledWrapper>
60
61
  <StyledListWrapper>
61
62
  <SortableList
@@ -4,7 +4,7 @@ import { ShowPropertyProps } from "adminjs";
4
4
  import { ThemeProvider } from "styled-components";
5
5
  import { theme } from "@adminjs/design-system";
6
6
 
7
- import { StringListShowLabel, StringListShowWrapper, ListItem } from "./styles";
7
+ import { StyledShowLabel, StyledShowWrapper, StyledListItem } from "./styles";
8
8
  import { separator } from "./constants";
9
9
 
10
10
  interface StringListShowPropsType extends ShowPropertyProps {
@@ -18,18 +18,18 @@ const StringListShow: FC<StringListShowPropsType> = ({
18
18
  }) => {
19
19
  return (
20
20
  <ThemeProvider theme={theme}>
21
- <StringListShowWrapper>
22
- <StringListShowLabel>{property.name}</StringListShowLabel>
21
+ <StyledShowWrapper>
22
+ <StyledShowLabel>{property.path}</StyledShowLabel>
23
23
  {record.params.facts && (
24
24
  <ul>
25
25
  {record.params.facts
26
26
  .split(stringListSeparator)
27
27
  .map((item: string, index: number) => (
28
- <ListItem key={index}>{`- ${item}`}</ListItem>
28
+ <StyledListItem key={index}>{`- ${item}`}</StyledListItem>
29
29
  ))}
30
30
  </ul>
31
31
  )}
32
- </StringListShowWrapper>
32
+ </StyledShowWrapper>
33
33
  </ThemeProvider>
34
34
  );
35
35
  };
@@ -1,5 +1,5 @@
1
- import { styled } from "@adminjs/design-system/styled-components";
2
1
  import { Box, Input } from "@adminjs/design-system";
2
+ import { styled } from "@adminjs/design-system/styled-components";
3
3
 
4
4
  export const StyledWrapper = styled(Box)`
5
5
  display: flex;
@@ -20,18 +20,22 @@ export const StyledListWrapper = styled(Box)`
20
20
  margin-bottom: 15px;
21
21
  `;
22
22
 
23
- export const StringListShowLabel = styled.div`
23
+ export const StyledLabel = styled.div`
24
24
  font-size: 12px;
25
25
  margin-bottom: 8px;
26
26
  text-transform: capitalize;
27
+ `;
28
+
29
+ export const StyledShowLabel = styled(StyledLabel)`
27
30
  line-height: 16px;
28
31
  color: rgb(137, 138, 154);
32
+ font-weight: 300;
29
33
  `;
30
34
 
31
- export const StringListShowWrapper = styled(Box)`
35
+ export const StyledShowWrapper = styled(Box)`
32
36
  margin-bottom: 35px;
33
37
  `;
34
38
 
35
- export const ListItem = styled.li`
39
+ export const StyledListItem = styled.li`
36
40
  margin-bottom: 5px;
37
41
  `;
@@ -3,3 +3,4 @@ export { default as StringList } from "./StringList/StringList.js";
3
3
  export { default as StringListShow } from "./StringList/StringListShow.js";
4
4
  export { default as Editor } from "./Editor/Editor.jsx";
5
5
  export { default as EditorShow } from "./Editor/EditorShow.jsx";
6
+ export { default as EditorList } from "./Editor/EditorList.jsx";