@rulab/adminjs-components 0.0.7 → 0.0.9

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.js CHANGED
@@ -1,7 +1,119 @@
1
+ // src/components/ColorStatus/ColorStatusEdit.tsx
2
+ import React, { useState, useEffect } from "react";
3
+ import Select from "react-select";
4
+ import chroma from "chroma-js";
5
+
6
+ // src/components/ColorStatus/styles.ts
7
+ import { styled } from "@adminjs/design-system/styled-components";
8
+ var ColorStatusWrapper = styled.div`
9
+ margin-bottom: 24px;
10
+ `;
11
+ var Label = styled.div`
12
+ font-size: 12px;
13
+ margin-bottom: 8px;
14
+ `;
15
+ var ShowLabel = styled.div`
16
+ font-size: 12px;
17
+ margin-bottom: 8px;
18
+ color: rgb(137, 138, 154);
19
+ `;
20
+ var ColorStatusBadgeWrapper = styled.div`
21
+ margin-bottom: 20px;
22
+ `;
23
+ var ColorStatusBadge = styled.div`
24
+ background-color: ${(props) => props.color};
25
+ width: fit-content;
26
+ padding: 5px 10px;
27
+ border-radius: 20px;
28
+ font-size: 12px;
29
+ color: white;
30
+ white-space: nowrap;
31
+ `;
32
+
33
+ // src/components/ColorStatus/ColorStatusEdit.tsx
34
+ var dot = (color = "transparent") => ({
35
+ alignItems: "center",
36
+ display: "flex",
37
+ ":before": {
38
+ backgroundColor: color,
39
+ borderRadius: 10,
40
+ content: '" "',
41
+ display: "block",
42
+ marginRight: 8,
43
+ height: 10,
44
+ width: 10
45
+ }
46
+ });
47
+ var colorStyles = {
48
+ control: (styles) => ({ ...styles, backgroundColor: "white" }),
49
+ option: (styles, { data, isDisabled, isFocused, isSelected }) => {
50
+ const color = chroma(data.color);
51
+ return {
52
+ ...styles,
53
+ backgroundColor: isSelected ? data.color : isFocused ? color.alpha(0.1).css() : void 0,
54
+ color: isSelected ? chroma.contrast(color, "white") > 2 ? "white" : "black" : data.color,
55
+ ":active": {
56
+ ...styles[":active"],
57
+ backgroundColor: isSelected ? data.color : color.alpha(0.3).css()
58
+ }
59
+ };
60
+ },
61
+ input: (styles) => ({ ...styles, ...dot() }),
62
+ placeholder: (styles) => ({ ...styles, ...dot("#ccc") }),
63
+ singleValue: (styles, { data }) => ({ ...styles, ...dot(data.color) })
64
+ };
65
+ var ColorStatus = ({ property, record, onChange }) => {
66
+ const availableValues = property.availableValues;
67
+ const currentOption = availableValues.find(
68
+ (item) => item.value === record.params.colorStatus
69
+ );
70
+ const [selectOption, setCurrentOption] = useState(currentOption);
71
+ const handleSelectChange = (option) => {
72
+ setCurrentOption(option);
73
+ };
74
+ useEffect(() => {
75
+ onChange(property.path, selectOption?.value);
76
+ }, [selectOption]);
77
+ return /* @__PURE__ */ React.createElement(ColorStatusWrapper, null, /* @__PURE__ */ React.createElement(Label, null, property.path), /* @__PURE__ */ React.createElement(
78
+ Select,
79
+ {
80
+ className: "basic-single",
81
+ classNamePrefix: "select",
82
+ defaultValue: selectOption ?? availableValues[0],
83
+ onChange: handleSelectChange,
84
+ isClearable: true,
85
+ name: "color",
86
+ options: availableValues,
87
+ styles: colorStyles
88
+ }
89
+ ));
90
+ };
91
+ var ColorStatusEdit_default = ColorStatus;
92
+
93
+ // src/components/ColorStatus/ColorStatusShow.tsx
94
+ import React2 from "react";
95
+ var ColorStatusShow = ({ property, record }) => {
96
+ const currentOption = property.availableValues?.find(
97
+ (item) => item.value === record.params.colorStatus
98
+ );
99
+ return /* @__PURE__ */ React2.createElement(ColorStatusBadgeWrapper, null, /* @__PURE__ */ React2.createElement(ShowLabel, null, property.path), /* @__PURE__ */ React2.createElement(ColorStatusBadge, { color: currentOption.color }, record.params.colorStatus));
100
+ };
101
+ var ColorStatusShow_default = ColorStatusShow;
102
+
103
+ // src/components/ColorStatus/ColorStatusList.tsx
104
+ import React3 from "react";
105
+ var ColorStatusList = ({ property, record }) => {
106
+ const currentOption = property.availableValues?.find(
107
+ (item) => item.value === record.params.colorStatus
108
+ );
109
+ return /* @__PURE__ */ React3.createElement(ColorStatusBadge, { color: currentOption.color }, record.params.colorStatus);
110
+ };
111
+ var ColorStatusList_default = ColorStatusList;
112
+
1
113
  // src/components/CustomSlug/CustomSlug.tsx
2
- import React, {
3
- useEffect,
4
- useState
114
+ import React4, {
115
+ useEffect as useEffect2,
116
+ useState as useState2
5
117
  } from "react";
6
118
  import { ThemeProvider } from "styled-components";
7
119
  import { theme } from "@adminjs/design-system";
@@ -22,20 +134,20 @@ var slugifyTitle = (title) => {
22
134
  };
23
135
 
24
136
  // src/components/CustomSlug/styles.ts
25
- import { styled } from "@adminjs/design-system/styled-components";
137
+ import { styled as styled2 } from "@adminjs/design-system/styled-components";
26
138
  import { Box, Button, Input } from "@adminjs/design-system";
27
- var StyledInputWrapper = styled(Box)`
139
+ var StyledInputWrapper = styled2(Box)`
28
140
  display: flex;
29
141
  margin-bottom: 40px;
30
142
  `;
31
- var StyledCustomInput = styled(Input)`
143
+ var StyledCustomInput = styled2(Input)`
32
144
  width: 100%;
33
145
  margin-right: 10px;
34
146
  `;
35
- var StyledGenerateButton = styled(Button)`
147
+ var StyledGenerateButton = styled2(Button)`
36
148
  white-space: nowrap;
37
149
  `;
38
- var StyledLabel = styled.div`
150
+ var StyledLabel = styled2.div`
39
151
  font-size: 12px;
40
152
  margin-bottom: 8px;
41
153
  text-transform: capitalize;
@@ -43,11 +155,11 @@ var StyledLabel = styled.div`
43
155
 
44
156
  // src/components/CustomSlug/CustomSlug.tsx
45
157
  var CustomSlug = ({ property, record, onChange }) => {
46
- const [inputValue, setInputValue] = useState(record.params.slug);
47
- useEffect(() => {
158
+ const [inputValue, setInputValue] = useState2(record.params.slug);
159
+ useEffect2(() => {
48
160
  onChange(property.path, inputValue);
49
161
  }, [inputValue]);
50
- return /* @__PURE__ */ React.createElement(ThemeProvider, { theme }, /* @__PURE__ */ React.createElement(StyledLabel, { htmlFor: "customSlug" }, property.path), /* @__PURE__ */ React.createElement(StyledInputWrapper, null, /* @__PURE__ */ React.createElement(
162
+ return /* @__PURE__ */ React4.createElement(ThemeProvider, { theme }, /* @__PURE__ */ React4.createElement(StyledLabel, { htmlFor: "customSlug" }, property.path), /* @__PURE__ */ React4.createElement(StyledInputWrapper, null, /* @__PURE__ */ React4.createElement(
51
163
  StyledCustomInput,
52
164
  {
53
165
  id: property.path,
@@ -55,7 +167,7 @@ var CustomSlug = ({ property, record, onChange }) => {
55
167
  value: inputValue,
56
168
  onChange: handleInput
57
169
  }
58
- ), /* @__PURE__ */ React.createElement(StyledGenerateButton, { variant: "outlined", onClick: generateSlug }, "Generate Slug")));
170
+ ), /* @__PURE__ */ React4.createElement(StyledGenerateButton, { variant: "outlined", onClick: generateSlug }, "Generate Slug")));
59
171
  function handleInput(e) {
60
172
  setInputValue(e.target.value);
61
173
  }
@@ -69,51 +181,246 @@ var CustomSlug = ({ property, record, onChange }) => {
69
181
  };
70
182
  var CustomSlug_default = CustomSlug;
71
183
 
184
+ // src/components/Editor/Editor.jsx
185
+ import React5, { memo, useState as useState3, useEffect as useEffect3, useRef } from "react";
186
+ import { ThemeProvider as ThemeProvider2 } from "styled-components";
187
+ import EditorJS from "@editorjs/editorjs";
188
+ import { theme as theme2 } from "@adminjs/design-system";
189
+
190
+ // src/components/Editor/styles.ts
191
+ import { Box as Box2 } from "@adminjs/design-system";
192
+ import { styled as styled3 } from "@adminjs/design-system/styled-components";
193
+ var StyledLabel2 = styled3.div`
194
+ font-size: 12px;
195
+ margin-bottom: 8px;
196
+ text-transform: capitalize;
197
+ `;
198
+ var StyledShowLabel = styled3(StyledLabel2)`
199
+ color: rgb(137, 138, 154);
200
+ font-weight: 300;
201
+ `;
202
+ var StyledEditorWrapper = styled3(Box2)`
203
+ padding: 12px;
204
+ margin-bottom: 24px;
205
+ border: 1px solid rgb(187, 195, 203);
206
+ `;
207
+ var StyledEditorViewWrapper = styled3(Box2)`
208
+ h1,
209
+ h2,
210
+ h3 {
211
+ margin-bottom: 5px;
212
+ font-weight: bold;
213
+ }
214
+
215
+ h1 {
216
+ font-size: 18px;
217
+ }
218
+
219
+ h2 {
220
+ font-size: 16px;
221
+ }
222
+
223
+ h3 {
224
+ font-size: 14px;
225
+ }
226
+
227
+ p {
228
+ margin-bottom: 8px;
229
+ }
230
+
231
+ ol,
232
+ ul {
233
+ margin-left: 20px;
234
+ margin-bottom: 8px;
235
+ }
236
+
237
+ ol {
238
+ list-style: auto;
239
+ }
240
+
241
+ ul {
242
+ list-style: inherit;
243
+ }
244
+ `;
245
+ var StyledEditorShowWrapper = styled3(StyledEditorViewWrapper)`
246
+ margin-bottom: 24px;
247
+ `;
248
+ var StyledEditor = styled3.div`
249
+ .cdx-block,
250
+ .ce-header {
251
+ padding-left: 58px;
252
+ }
253
+
254
+ .cdx-list {
255
+ padding-left: 85px;
256
+ }
257
+
258
+ .ce-block__content {
259
+ width: 100%;
260
+ max-width: none;
261
+ }
262
+
263
+ .ce-toolbar__content {
264
+ max-width: none;
265
+ left: 0;
266
+ }
267
+
268
+ .ce-toolbar__actions {
269
+ left: 0;
270
+ }
271
+
272
+ h1.ce-header {
273
+ font-size: 22px;
274
+ font-weight: bold;
275
+ }
276
+
277
+ h2.ce-header {
278
+ font-size: 20px;
279
+ font-weight: bold;
280
+ }
281
+
282
+ h3.ce-header {
283
+ font-size: 18px;
284
+ font-weight: bold;
285
+ }
286
+
287
+ h4.ce-header {
288
+ font-size: 16px;
289
+ font-weight: bold;
290
+ }
291
+
292
+ h5.ce-header {
293
+ font-size: 15px;
294
+ font-weight: bold;
295
+ }
296
+
297
+ h6.ce-header {
298
+ font-size: 14px;
299
+ font-weight: bold;
300
+ }
301
+ `;
302
+
303
+ // src/components/Editor/config.ts
304
+ import Header from "@editorjs/header";
305
+ import Paragraph from "@editorjs/paragraph";
306
+ import List from "@editorjs/list";
307
+ var EDITOR_TOOLS = {
308
+ paragraph: {
309
+ class: Paragraph,
310
+ inlineToolbar: true
311
+ },
312
+ list: List,
313
+ header: Header
314
+ };
315
+
316
+ // src/components/Editor/Editor.jsx
317
+ var Editor = ({ property, record, onChangeAdmin, editorId }) => {
318
+ const [jsonData, setJsonData] = useState3();
319
+ const isSavedData = Boolean(record.params[property.path]);
320
+ const ref = useRef();
321
+ useEffect3(() => {
322
+ onChangeAdmin(property.path, jsonData);
323
+ }, [jsonData]);
324
+ useEffect3(() => {
325
+ if (!ref.current) {
326
+ const editor = new EditorJS({
327
+ holder: editorId,
328
+ tools: EDITOR_TOOLS,
329
+ data: isSavedData ? JSON.parse(record.params[property.path]) : "",
330
+ async onChange(api, event) {
331
+ const data = await api.saver.save();
332
+ setJsonData(JSON.stringify(data));
333
+ }
334
+ });
335
+ ref.current = editor;
336
+ }
337
+ return () => {
338
+ ref?.current?.destroy?.();
339
+ };
340
+ }, []);
341
+ return /* @__PURE__ */ React5.createElement(ThemeProvider2, { theme: theme2 }, /* @__PURE__ */ React5.createElement(StyledLabel2, null, property.path), /* @__PURE__ */ React5.createElement(StyledEditorWrapper, null, /* @__PURE__ */ React5.createElement(StyledEditor, { id: editorId })));
342
+ };
343
+ var Editor_default = Editor;
344
+
345
+ // src/components/Editor/EditorList.jsx
346
+ import React6 from "react";
347
+ import { ThemeProvider as ThemeProvider3 } from "styled-components";
348
+ import { theme as theme3 } from "@adminjs/design-system";
349
+
350
+ // src/utils/parseHtml.ts
351
+ import edjsHTML from "editorjs-html";
352
+ var parseHtml = (jsonData) => {
353
+ const edjsParser = edjsHTML();
354
+ try {
355
+ const data = edjsParser.parse(JSON.parse(String(jsonData)));
356
+ return String(data).replace(/>,</g, "><");
357
+ } catch (e) {
358
+ return;
359
+ }
360
+ };
361
+
362
+ // src/components/Editor/EditorList.jsx
363
+ var EditorList = ({ property, record }) => {
364
+ const htmlContent = parseHtml(record.params[property.path]);
365
+ return /* @__PURE__ */ React6.createElement(ThemeProvider3, { theme: theme3 }, /* @__PURE__ */ React6.createElement(StyledEditorViewWrapper, null, htmlContent && /* @__PURE__ */ React6.createElement("div", { dangerouslySetInnerHTML: { __html: htmlContent } })));
366
+ };
367
+ var EditorList_default = EditorList;
368
+
369
+ // src/components/Editor/EditorShow.jsx
370
+ import React7 from "react";
371
+ import { ThemeProvider as ThemeProvider4 } from "styled-components";
372
+ import { theme as theme4 } from "@adminjs/design-system";
373
+ var EditorShow = ({ property, record }) => {
374
+ const htmlContent = parseHtml(record.params[property.path]);
375
+ return /* @__PURE__ */ React7.createElement(ThemeProvider4, { theme: theme4 }, /* @__PURE__ */ React7.createElement(StyledEditorShowWrapper, null, /* @__PURE__ */ React7.createElement(StyledShowLabel, null, property.path), htmlContent && /* @__PURE__ */ React7.createElement("div", { dangerouslySetInnerHTML: { __html: htmlContent } })));
376
+ };
377
+ var EditorShow_default = EditorShow;
378
+
72
379
  // src/components/StringList/StringList.tsx
73
- import { Button as Button3, Input as Input3, theme as theme2 } from "@adminjs/design-system";
74
- import React5, {
75
- useEffect as useEffect2,
76
- useState as useState3
380
+ import { Button as Button3, Input as Input3, theme as theme5 } from "@adminjs/design-system";
381
+ import React11, {
382
+ useEffect as useEffect4,
383
+ useState as useState5
77
384
  } from "react";
78
- import { ThemeProvider as ThemeProvider2 } from "styled-components";
385
+ import { ThemeProvider as ThemeProvider5 } from "styled-components";
79
386
 
80
387
  // src/components/StringList/styles.ts
81
- import { Box as Box2, Input as Input2 } from "@adminjs/design-system";
82
- import { styled as styled2 } from "@adminjs/design-system/styled-components";
83
- var StyledWrapper = styled2(Box2)`
388
+ import { Box as Box3, Input as Input2 } from "@adminjs/design-system";
389
+ import { styled as styled4 } from "@adminjs/design-system/styled-components";
390
+ var StyledWrapper = styled4(Box3)`
84
391
  display: flex;
85
392
  flex-direction: column;
86
393
  margin-bottom: 45px;
87
394
  `;
88
- var StyledCustomInput2 = styled2(Input2)`
395
+ var StyledCustomInput2 = styled4(Input2)`
89
396
  width: 100%;
90
397
  margin-right: 10px;
91
398
  `;
92
- var StyledInputWrapper2 = styled2(Box2)`
399
+ var StyledInputWrapper2 = styled4(Box3)`
93
400
  display: flex;
94
401
  `;
95
- var StyledListWrapper = styled2(Box2)`
402
+ var StyledListWrapper = styled4(Box3)`
96
403
  margin-bottom: 15px;
97
404
  `;
98
- var StyledLabel2 = styled2.div`
405
+ var StyledLabel3 = styled4.div`
99
406
  font-size: 12px;
100
407
  margin-bottom: 8px;
101
408
  text-transform: capitalize;
102
409
  `;
103
- var StyledShowLabel = styled2(StyledLabel2)`
410
+ var StyledShowLabel2 = styled4(StyledLabel3)`
104
411
  line-height: 16px;
105
412
  color: rgb(137, 138, 154);
106
413
  font-weight: 300;
107
414
  `;
108
- var StyledShowWrapper = styled2(Box2)`
415
+ var StyledShowWrapper = styled4(Box3)`
109
416
  margin-bottom: 35px;
110
417
  `;
111
- var StyledListItem = styled2.li`
418
+ var StyledListItem = styled4.li`
112
419
  margin-bottom: 5px;
113
420
  `;
114
421
 
115
422
  // src/components/StringList/SortableList/SortableList.tsx
116
- import React4, { Fragment, useMemo as useMemo2, useState as useState2 } from "react";
423
+ import React10, { Fragment, useMemo as useMemo2, useState as useState4 } from "react";
117
424
  import {
118
425
  DndContext,
119
426
  KeyboardSensor,
@@ -131,16 +438,16 @@ import {
131
438
  } from "@dnd-kit/sortable";
132
439
 
133
440
  // src/components/StringList/SortableList/components/SortableItem/SortableItem.tsx
134
- import React3, { createContext, useMemo } from "react";
441
+ import React9, { createContext, useMemo } from "react";
135
442
  import { useSortable } from "@dnd-kit/sortable";
136
443
  import { Button as Button2, Icon } from "@adminjs/design-system";
137
444
 
138
445
  // src/components/StringList/SortableList/components/SortableItem/DragHandle.tsx
139
- import React2, { useContext } from "react";
446
+ import React8, { useContext } from "react";
140
447
 
141
448
  // src/components/StringList/SortableList/components/SortableItem/styles.ts
142
- import { styled as styled3 } from "@adminjs/design-system/styled-components";
143
- var StyledListItem2 = styled3.li`
449
+ import { styled as styled5 } from "@adminjs/design-system/styled-components";
450
+ var StyledListItem2 = styled5.li`
144
451
  display: flex;
145
452
  justify-content: space-between;
146
453
  align-items: center;
@@ -152,7 +459,7 @@ var StyledListItem2 = styled3.li`
152
459
  border-radius: 5px;
153
460
  list-style: none;
154
461
  `;
155
- var StyledDragButton = styled3.button`
462
+ var StyledDragButton = styled5.button`
156
463
  padding: 3px;
157
464
  margin-right: 15px;
158
465
  cursor: move;
@@ -163,7 +470,7 @@ var StyledDragButton = styled3.button`
163
470
  // src/components/StringList/SortableList/components/SortableItem/DragHandle.tsx
164
471
  var DragHandle = ({ context }) => {
165
472
  const { attributes, listeners, ref } = useContext(context);
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" })));
473
+ return /* @__PURE__ */ React8.createElement(StyledDragButton, { ...attributes, ...listeners, ref }, /* @__PURE__ */ React8.createElement("svg", { viewBox: "0 0 20 20", width: "13" }, /* @__PURE__ */ React8.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" })));
167
474
  };
168
475
 
169
476
  // src/components/StringList/SortableList/components/SortableItem/SortableItem.tsx
@@ -190,7 +497,7 @@ function SortableItem({
190
497
  const style = {
191
498
  opacity: isDragging ? 0.4 : void 0
192
499
  };
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(
500
+ return /* @__PURE__ */ React9.createElement(SortableItemContext.Provider, { value: context }, /* @__PURE__ */ React9.createElement(StyledListItem2, { ref: setNodeRef, style }, /* @__PURE__ */ React9.createElement("div", null, /* @__PURE__ */ React9.createElement(DragHandle, { context: SortableItemContext }), children), /* @__PURE__ */ React9.createElement(
194
501
  Button2,
195
502
  {
196
503
  variant: "outlined",
@@ -198,13 +505,13 @@ function SortableItem({
198
505
  size: "icon",
199
506
  onClick: (e) => onDelete(e, id)
200
507
  },
201
- /* @__PURE__ */ React3.createElement(Icon, { icon: "X", color: "red" })
508
+ /* @__PURE__ */ React9.createElement(Icon, { icon: "X", color: "red" })
202
509
  )));
203
510
  }
204
511
 
205
512
  // src/components/StringList/SortableList/styles.ts
206
- import { styled as styled4 } from "@adminjs/design-system/styled-components";
207
- var StyledListWrapper2 = styled4.ul`
513
+ import { styled as styled6 } from "@adminjs/design-system/styled-components";
514
+ var StyledListWrapper2 = styled6.ul`
208
515
  display: flex;
209
516
  flex-direction: column;
210
517
  gap: 12px;
@@ -227,7 +534,7 @@ function SortableList({
227
534
  onChange,
228
535
  renderItem
229
536
  }) {
230
- const [active, setActive] = useState2(null);
537
+ const [active, setActive] = useState4(null);
231
538
  const activeItem = useMemo2(
232
539
  () => items.find((item) => item.id === active?.id),
233
540
  [active, items]
@@ -238,7 +545,7 @@ function SortableList({
238
545
  coordinateGetter: sortableKeyboardCoordinates
239
546
  })
240
547
  );
241
- return /* @__PURE__ */ React4.createElement(
548
+ return /* @__PURE__ */ React10.createElement(
242
549
  DndContext,
243
550
  {
244
551
  sensors,
@@ -257,8 +564,8 @@ function SortableList({
257
564
  setActive(null);
258
565
  }
259
566
  },
260
- /* @__PURE__ */ React4.createElement(SortableContext, { items, strategy: verticalListSortingStrategy }, /* @__PURE__ */ React4.createElement(StyledListWrapper2, { role: "application" }, items.map((item, index) => /* @__PURE__ */ React4.createElement(Fragment, { key: index }, renderItem(item))))),
261
- /* @__PURE__ */ React4.createElement(DragOverlay, { dropAnimation: dropAnimationConfig }, activeItem ? renderItem(activeItem) : null)
567
+ /* @__PURE__ */ React10.createElement(SortableContext, { items, strategy: verticalListSortingStrategy }, /* @__PURE__ */ React10.createElement(StyledListWrapper2, { role: "application" }, items.map((item, index) => /* @__PURE__ */ React10.createElement(Fragment, { key: index }, renderItem(item))))),
568
+ /* @__PURE__ */ React10.createElement(DragOverlay, { dropAnimation: dropAnimationConfig }, activeItem ? renderItem(activeItem) : null)
262
569
  );
263
570
  }
264
571
  SortableList.Item = SortableItem;
@@ -275,20 +582,20 @@ var StringList = ({
275
582
  }) => {
276
583
  const stringListValue = record.params?.[property.path] ?? property.props.value ?? "";
277
584
  const initialList = stringListValue ? prepareDataForList(stringListValue) : [];
278
- const [inputValue, setInputValue] = useState3("");
279
- const [list, setList] = useState3(initialList);
585
+ const [inputValue, setInputValue] = useState5("");
586
+ const [list, setList] = useState5(initialList);
280
587
  const serializedData = prepareDataForDatabase(list);
281
- useEffect2(() => {
588
+ useEffect4(() => {
282
589
  onChange(property.path, serializedData);
283
590
  }, [serializedData]);
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(
591
+ return /* @__PURE__ */ React11.createElement(ThemeProvider5, { theme: theme5 }, /* @__PURE__ */ React11.createElement(StyledLabel3, { htmlFor: "custom" }, property.path), /* @__PURE__ */ React11.createElement(StyledWrapper, null, /* @__PURE__ */ React11.createElement(StyledListWrapper, null, /* @__PURE__ */ React11.createElement(
285
592
  SortableList,
286
593
  {
287
594
  items: list,
288
595
  onChange: setList,
289
- renderItem: (item) => /* @__PURE__ */ React5.createElement(SortableList.Item, { id: item.id, onDelete: handleDeleteButton }, item.value)
596
+ renderItem: (item) => /* @__PURE__ */ React11.createElement(SortableList.Item, { id: item.id, onDelete: handleDeleteButton }, item.value)
290
597
  }
291
- )), /* @__PURE__ */ React5.createElement(StyledInputWrapper2, null, /* @__PURE__ */ React5.createElement(
598
+ )), /* @__PURE__ */ React11.createElement(StyledInputWrapper2, null, /* @__PURE__ */ React11.createElement(
292
599
  Input3,
293
600
  {
294
601
  id: "stringList",
@@ -296,7 +603,7 @@ var StringList = ({
296
603
  value: serializedData,
297
604
  hidden: true
298
605
  }
299
- ), /* @__PURE__ */ React5.createElement(
606
+ ), /* @__PURE__ */ React11.createElement(
300
607
  StyledCustomInput2,
301
608
  {
302
609
  id: "custom",
@@ -305,7 +612,7 @@ var StringList = ({
305
612
  onChange: handleInput,
306
613
  onKeyPress: handleEnterPress
307
614
  }
308
- ), /* @__PURE__ */ React5.createElement(Button3, { variant: "outlined", onClick: handleAddButton }, "Add"))));
615
+ ), /* @__PURE__ */ React11.createElement(Button3, { variant: "outlined", onClick: handleAddButton }, "Add"))));
309
616
  function handleInput(e) {
310
617
  setInputValue(e.target.value);
311
618
  }
@@ -342,204 +649,24 @@ var StringList = ({
342
649
  var StringList_default = StringList;
343
650
 
344
651
  // src/components/StringList/StringListShow.tsx
345
- import React6 from "react";
346
- import { ThemeProvider as ThemeProvider3 } from "styled-components";
347
- import { theme as theme3 } from "@adminjs/design-system";
652
+ import React12 from "react";
653
+ import { ThemeProvider as ThemeProvider6 } from "styled-components";
654
+ import { theme as theme6 } from "@adminjs/design-system";
348
655
  var StringListShow = ({
349
656
  property,
350
657
  record,
351
658
  stringListSeparator = separator
352
659
  }) => {
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}`)))));
660
+ return /* @__PURE__ */ React12.createElement(ThemeProvider6, { theme: theme6 }, /* @__PURE__ */ React12.createElement(StyledShowWrapper, null, /* @__PURE__ */ React12.createElement(StyledShowLabel2, null, property.path), record.params.facts && /* @__PURE__ */ React12.createElement("ul", null, record.params.facts.split(stringListSeparator).map((item, index) => /* @__PURE__ */ React12.createElement(StyledListItem, { key: index }, `- ${item}`)))));
354
661
  };
355
662
  var StringListShow_default = StringListShow;
356
-
357
- // src/components/Editor/Editor.jsx
358
- import React7, { memo as memo2, useState as useState5, useEffect as useEffect4, useRef as useRef2 } from "react";
359
- import { ThemeProvider as ThemeProvider4 } from "styled-components";
360
- import EditorJS from "@editorjs/editorjs";
361
- import { theme as theme4 } from "@adminjs/design-system";
362
-
363
- // src/components/Editor/styles.ts
364
- import { Box as Box3 } from "@adminjs/design-system";
365
- import { styled as styled5 } from "@adminjs/design-system/styled-components";
366
- var StyledLabel3 = styled5.div`
367
- font-size: 12px;
368
- margin-bottom: 8px;
369
- text-transform: capitalize;
370
- `;
371
- var StyledShowLabel2 = styled5(StyledLabel3)`
372
- color: rgb(137, 138, 154);
373
- font-weight: 300;
374
- `;
375
- var StyledEditorWrapper = styled5(Box3)`
376
- padding: 12px;
377
- margin-bottom: 24px;
378
- border: 1px solid rgb(187, 195, 203);
379
- `;
380
- var StyledEditorShowWrapper = styled5(Box3)`
381
- margin-bottom: 24px;
382
-
383
- h1,
384
- h2,
385
- h3 {
386
- margin-bottom: 5px;
387
- font-weight: bold;
388
- }
389
-
390
- h1 {
391
- font-size: 18px;
392
- }
393
-
394
- h2 {
395
- font-size: 16px;
396
- }
397
-
398
- h3 {
399
- font-size: 14px;
400
- }
401
-
402
- p {
403
- margin-bottom: 8px;
404
- }
405
-
406
- ol,
407
- ul {
408
- margin-left: 20px;
409
- margin-bottom: 8px;
410
- }
411
-
412
- ol {
413
- list-style: auto;
414
- }
415
-
416
- ul {
417
- list-style: inherit;
418
- }
419
- `;
420
- var StyledEditor = styled5.div`
421
- .cdx-block,
422
- .ce-header {
423
- padding-left: 58px;
424
- }
425
-
426
- .cdx-list {
427
- padding-left: 85px;
428
- }
429
-
430
- .ce-block__content {
431
- width: 100%;
432
- max-width: none;
433
- }
434
-
435
- .ce-toolbar__content {
436
- max-width: none;
437
- left: 0;
438
- }
439
-
440
- .ce-toolbar__actions {
441
- left: 0;
442
- }
443
-
444
- h1.ce-header {
445
- font-size: 22px;
446
- font-weight: bold;
447
- }
448
-
449
- h2.ce-header {
450
- font-size: 20px;
451
- font-weight: bold;
452
- }
453
-
454
- h3.ce-header {
455
- font-size: 18px;
456
- font-weight: bold;
457
- }
458
-
459
- h4.ce-header {
460
- font-size: 16px;
461
- font-weight: bold;
462
- }
463
-
464
- h5.ce-header {
465
- font-size: 15px;
466
- font-weight: bold;
467
- }
468
-
469
- h6.ce-header {
470
- font-size: 14px;
471
- font-weight: bold;
472
- }
473
- `;
474
-
475
- // src/components/Editor/config.ts
476
- import Header from "@editorjs/header";
477
- import Paragraph from "@editorjs/paragraph";
478
- import List from "@editorjs/list";
479
- var EDITOR_TOOLS = {
480
- paragraph: {
481
- class: Paragraph,
482
- inlineToolbar: true
483
- },
484
- list: List,
485
- header: Header
486
- };
487
-
488
- // src/components/Editor/Editor.jsx
489
- var Editor = ({ property, record, onChangeAdmin, editorId }) => {
490
- const [jsonData, setJsonData] = useState5();
491
- const isSavedData = Boolean(record.params[property.path]);
492
- const ref = useRef2();
493
- useEffect4(() => {
494
- onChangeAdmin(property.path, jsonData);
495
- }, [jsonData]);
496
- useEffect4(() => {
497
- if (!ref.current) {
498
- const editor = new EditorJS({
499
- holder: editorId,
500
- tools: EDITOR_TOOLS,
501
- data: isSavedData ? JSON.parse(record.params[property.path]) : "",
502
- async onChange(api, event) {
503
- const data = await api.saver.save();
504
- setJsonData(JSON.stringify(data));
505
- }
506
- });
507
- ref.current = editor;
508
- }
509
- return () => {
510
- ref?.current?.destroy?.();
511
- };
512
- }, []);
513
- 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 })));
514
- };
515
- var Editor_default = Editor;
516
-
517
- // src/components/Editor/EditorShow.jsx
518
- import React8, { memo as memo3, useState as useState6, useEffect as useEffect5, useRef as useRef3 } from "react";
519
- import { ThemeProvider as ThemeProvider5 } from "styled-components";
520
- import { theme as theme5 } from "@adminjs/design-system";
521
-
522
- // src/utils/parseHtml.ts
523
- import edjsHTML from "editorjs-html";
524
- var parseHtml = (jsonData) => {
525
- const edjsParser = edjsHTML();
526
- try {
527
- const data = edjsParser.parse(JSON.parse(String(jsonData)));
528
- return String(data).replace(/>,</g, "><");
529
- } catch (e) {
530
- return;
531
- }
532
- };
533
-
534
- // src/components/Editor/EditorShow.jsx
535
- var EditorShow = ({ property, record }) => {
536
- const htmlContent = parseHtml(record.params[property.path]);
537
- 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 } })));
538
- };
539
- var EditorShow_default = EditorShow;
540
663
  export {
664
+ ColorStatusEdit_default as ColorStatusEdit,
665
+ ColorStatusList_default as ColorStatusList,
666
+ ColorStatusShow_default as ColorStatusShow,
541
667
  CustomSlug_default as CustomSlug,
542
668
  Editor_default as Editor,
669
+ EditorList_default as EditorList,
543
670
  EditorShow_default as EditorShow,
544
671
  StringList_default as StringList,
545
672
  StringListShow_default as StringListShow