@rulab/adminjs-components 0.0.13 → 0.1.0-alpha.2

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 (71) hide show
  1. package/LICENSE +21 -21
  2. package/dist/index.cjs +10 -762
  3. package/dist/index.cjs.map +1 -0
  4. package/dist/index.d.cts +10 -21
  5. package/dist/index.d.ts +10 -21
  6. package/dist/index.js +3 -754
  7. package/dist/index.js.map +1 -0
  8. package/package.json +12 -8
  9. package/src/components/ColorStatus/ColorStatusEdit.tsx +94 -94
  10. package/src/components/ColorStatus/ColorStatusList.tsx +20 -20
  11. package/src/components/ColorStatus/ColorStatusShow.tsx +23 -23
  12. package/src/components/ColorStatus/index.ts +3 -3
  13. package/src/components/ColorStatus/styles.ts +30 -30
  14. package/src/components/ColorStatus/types.ts +5 -5
  15. package/src/components/Editor/Editor.jsx +49 -49
  16. package/src/components/Editor/EditorList.jsx +22 -22
  17. package/src/components/Editor/EditorShow.jsx +24 -24
  18. package/src/components/Editor/config.ts +35 -35
  19. package/src/components/Editor/index.ts +3 -3
  20. package/src/components/Editor/styles.ts +151 -151
  21. package/src/components/{CustomSlug/CustomSlug.tsx → Slug/SlugEdit.tsx} +68 -68
  22. package/src/components/Slug/SlugFeature.ts +30 -0
  23. package/src/components/Slug/index.ts +1 -0
  24. package/src/components/{CustomSlug → Slug}/styles.ts +24 -24
  25. package/src/components/StringList/SortableList/SortableList.tsx +98 -98
  26. package/src/components/StringList/SortableList/components/SortableItem/DragHandle.tsx +20 -20
  27. package/src/components/StringList/SortableList/components/SortableItem/SortableItem.tsx +59 -59
  28. package/src/components/StringList/SortableList/components/SortableItem/styles.ts +22 -22
  29. package/src/components/StringList/SortableList/components/SortableItem/types.ts +7 -7
  30. package/src/components/StringList/SortableList/components/index.ts +2 -2
  31. package/src/components/StringList/SortableList/index.ts +1 -1
  32. package/src/components/StringList/SortableList/styles.ts +9 -9
  33. package/src/components/StringList/StringList.tsx +136 -136
  34. package/src/components/StringList/StringListShow.tsx +37 -37
  35. package/src/components/StringList/constants.ts +1 -1
  36. package/src/components/StringList/index.ts +2 -2
  37. package/src/components/StringList/styles.ts +41 -41
  38. package/src/components/index.ts +10 -9
  39. package/dist/bundle.js +0 -8
  40. package/dist/components/CustomSlug/CustomSlug.jsx +0 -29
  41. package/dist/components/CustomSlug/index.js +0 -1
  42. package/dist/components/CustomSlug/styles.js +0 -15
  43. package/dist/components/Editor/config.js +0 -11
  44. package/dist/components/Editor/index.js +0 -1
  45. package/dist/components/Editor/styles.js +0 -64
  46. package/dist/components/StringList/SortableList/SortableList.jsx +0 -43
  47. package/dist/components/StringList/SortableList/components/SortableItem/DragHandle.jsx +0 -10
  48. package/dist/components/StringList/SortableList/components/SortableItem/SortableItem.jsx +0 -32
  49. package/dist/components/StringList/SortableList/components/SortableItem/styles.js +0 -20
  50. package/dist/components/StringList/SortableList/components/SortableItem/types.js +0 -1
  51. package/dist/components/StringList/SortableList/components/index.js +0 -2
  52. package/dist/components/StringList/SortableList/index.js +0 -1
  53. package/dist/components/StringList/SortableList/styles.js +0 -8
  54. package/dist/components/StringList/StringList.jsx +0 -67
  55. package/dist/components/StringList/index.js +0 -1
  56. package/dist/components/StringList/styles.js +0 -16
  57. package/dist/components/index.js +0 -3
  58. package/dist/editorFeature.js +0 -16
  59. package/dist/index.d.mts +0 -8
  60. package/dist/index.mjs +0 -37
  61. package/dist/utils/index.js +0 -1
  62. package/dist/utils/slugifyImport.js +0 -3
  63. package/dist/utils/slugifyTitle.js +0 -10
  64. package/src/components/CustomSlug/index.ts +0 -1
  65. package/src/index.ts +0 -2
  66. package/src/types.d.ts +0 -3
  67. package/src/utils/index.ts +0 -3
  68. package/src/utils/parseHtml.ts +0 -56
  69. package/src/utils/slugifyImport.ts +0 -4
  70. package/src/utils/slugifyTitle.ts +0 -11
  71. package/tsconfig.json +0 -17
@@ -1,3 +1,3 @@
1
- export * from "./Editor.jsx";
2
- export * from "./EditorShow.jsx";
3
- export * from "./EditorList.jsx";
1
+ export * from "./Editor.jsx";
2
+ export * from "./EditorShow.jsx";
3
+ export * from "./EditorList.jsx";
@@ -1,151 +1,151 @@
1
- import { Box } from "@adminjs/design-system";
2
- import { styled } from "@adminjs/design-system/styled-components";
3
-
4
- export const StyledLabel = styled.div`
5
- font-size: 12px;
6
- margin-bottom: 8px;
7
- text-transform: capitalize;
8
- `;
9
-
10
- export const StyledShowLabel = styled(StyledLabel)`
11
- color: rgb(137, 138, 154);
12
- font-weight: 300;
13
- `;
14
-
15
- export const StyledEditorWrapper = styled(Box)`
16
- padding: 12px;
17
- margin-bottom: 24px;
18
- border: 1px solid rgb(187, 195, 203);
19
- `;
20
-
21
- export const StyledEditorViewWrapper = styled(Box)`
22
- h1,
23
- h2,
24
- h3 {
25
- margin-bottom: 5px;
26
- font-weight: bold;
27
- }
28
-
29
- h1 {
30
- font-size: 18px;
31
- }
32
-
33
- h2 {
34
- font-size: 16px;
35
- }
36
-
37
- h3 {
38
- font-size: 14px;
39
- }
40
-
41
- p {
42
- margin-bottom: 8px;
43
- }
44
-
45
- ol,
46
- ul {
47
- margin-left: 20px;
48
- margin-bottom: 8px;
49
- }
50
-
51
- ol {
52
- list-style: auto;
53
- }
54
-
55
- ul {
56
- list-style: inherit;
57
- }
58
-
59
- table,
60
- audio {
61
- margin: 16px 0;
62
- }
63
-
64
- table,
65
- th,
66
- td {
67
- border: 1px solid;
68
- }
69
-
70
- th {
71
- font-weight: bold;
72
- }
73
-
74
- th,
75
- td {
76
- padding: 4px;
77
- }
78
-
79
- blockquote {
80
- display: block;
81
- padding: 5px 8px;
82
- width: fit-content;
83
- border-radius: 4px;
84
- background-color: #e6e6e6;
85
- }
86
- `;
87
-
88
- export const StyledEditorShowWrapper = styled(StyledEditorViewWrapper)`
89
- margin-bottom: 24px;
90
- `;
91
-
92
- export const StyledEditor = styled.div`
93
- audio,
94
- .cdx-block,
95
- .ce-header {
96
- padding-left: 58px;
97
- }
98
-
99
- input {
100
- margin-left: 58px;
101
- width: auto;
102
- }
103
-
104
- .cdx-list {
105
- padding-left: 85px;
106
- }
107
-
108
- .ce-block__content {
109
- width: 100%;
110
- max-width: none;
111
- }
112
-
113
- .ce-toolbar__content {
114
- max-width: none;
115
- left: 0;
116
- }
117
-
118
- .ce-toolbar__actions {
119
- left: 0;
120
- }
121
-
122
- h1.ce-header {
123
- font-size: 22px;
124
- font-weight: bold;
125
- }
126
-
127
- h2.ce-header {
128
- font-size: 20px;
129
- font-weight: bold;
130
- }
131
-
132
- h3.ce-header {
133
- font-size: 18px;
134
- font-weight: bold;
135
- }
136
-
137
- h4.ce-header {
138
- font-size: 16px;
139
- font-weight: bold;
140
- }
141
-
142
- h5.ce-header {
143
- font-size: 15px;
144
- font-weight: bold;
145
- }
146
-
147
- h6.ce-header {
148
- font-size: 14px;
149
- font-weight: bold;
150
- }
151
- `;
1
+ import { Box } from "@adminjs/design-system";
2
+ import { styled } from "@adminjs/design-system/styled-components";
3
+
4
+ export const StyledLabel = styled.div`
5
+ font-size: 12px;
6
+ margin-bottom: 8px;
7
+ text-transform: capitalize;
8
+ `;
9
+
10
+ export const StyledShowLabel = styled(StyledLabel)`
11
+ color: rgb(137, 138, 154);
12
+ font-weight: 300;
13
+ `;
14
+
15
+ export const StyledEditorWrapper = styled(Box)`
16
+ padding: 12px;
17
+ margin-bottom: 24px;
18
+ border: 1px solid rgb(187, 195, 203);
19
+ `;
20
+
21
+ export const StyledEditorViewWrapper = styled(Box)`
22
+ h1,
23
+ h2,
24
+ h3 {
25
+ margin-bottom: 5px;
26
+ font-weight: bold;
27
+ }
28
+
29
+ h1 {
30
+ font-size: 18px;
31
+ }
32
+
33
+ h2 {
34
+ font-size: 16px;
35
+ }
36
+
37
+ h3 {
38
+ font-size: 14px;
39
+ }
40
+
41
+ p {
42
+ margin-bottom: 8px;
43
+ }
44
+
45
+ ol,
46
+ ul {
47
+ margin-left: 20px;
48
+ margin-bottom: 8px;
49
+ }
50
+
51
+ ol {
52
+ list-style: auto;
53
+ }
54
+
55
+ ul {
56
+ list-style: inherit;
57
+ }
58
+
59
+ table,
60
+ audio {
61
+ margin: 16px 0;
62
+ }
63
+
64
+ table,
65
+ th,
66
+ td {
67
+ border: 1px solid;
68
+ }
69
+
70
+ th {
71
+ font-weight: bold;
72
+ }
73
+
74
+ th,
75
+ td {
76
+ padding: 4px;
77
+ }
78
+
79
+ blockquote {
80
+ display: block;
81
+ padding: 5px 8px;
82
+ width: fit-content;
83
+ border-radius: 4px;
84
+ background-color: #e6e6e6;
85
+ }
86
+ `;
87
+
88
+ export const StyledEditorShowWrapper = styled(StyledEditorViewWrapper)`
89
+ margin-bottom: 24px;
90
+ `;
91
+
92
+ export const StyledEditor = styled.div`
93
+ audio,
94
+ .cdx-block,
95
+ .ce-header {
96
+ padding-left: 58px;
97
+ }
98
+
99
+ input {
100
+ margin-left: 58px;
101
+ width: auto;
102
+ }
103
+
104
+ .cdx-list {
105
+ padding-left: 85px;
106
+ }
107
+
108
+ .ce-block__content {
109
+ width: 100%;
110
+ max-width: none;
111
+ }
112
+
113
+ .ce-toolbar__content {
114
+ max-width: none;
115
+ left: 0;
116
+ }
117
+
118
+ .ce-toolbar__actions {
119
+ left: 0;
120
+ }
121
+
122
+ h1.ce-header {
123
+ font-size: 22px;
124
+ font-weight: bold;
125
+ }
126
+
127
+ h2.ce-header {
128
+ font-size: 20px;
129
+ font-weight: bold;
130
+ }
131
+
132
+ h3.ce-header {
133
+ font-size: 18px;
134
+ font-weight: bold;
135
+ }
136
+
137
+ h4.ce-header {
138
+ font-size: 16px;
139
+ font-weight: bold;
140
+ }
141
+
142
+ h5.ce-header {
143
+ font-size: 15px;
144
+ font-weight: bold;
145
+ }
146
+
147
+ h6.ce-header {
148
+ font-size: 14px;
149
+ font-weight: bold;
150
+ }
151
+ `;
@@ -1,68 +1,68 @@
1
- import { EditPropertyProps } from "adminjs";
2
- import React, {
3
- ChangeEvent,
4
- FC,
5
- SyntheticEvent,
6
- useEffect,
7
- useState,
8
- } from "react";
9
- import { ThemeProvider } from "styled-components";
10
-
11
- import { theme } from "@adminjs/design-system";
12
-
13
- import { slugifyTitle } from "../../utils/index.js";
14
-
15
- import {
16
- StyledCustomInput,
17
- StyledGenerateButton,
18
- StyledInputWrapper,
19
- StyledLabel,
20
- } from "./styles.js";
21
-
22
- type CustomSlugTypes = Omit<EditPropertyProps, "where">;
23
-
24
- const CustomSlug: FC<CustomSlugTypes> = ({
25
- property,
26
- record,
27
- resource,
28
- onChange,
29
- }) => {
30
- const [inputValue, setInputValue] = useState(record.params.slug);
31
-
32
- useEffect(() => {
33
- onChange(property.path, inputValue);
34
- }, [inputValue]);
35
-
36
- return (
37
- <ThemeProvider theme={theme}>
38
- <StyledLabel htmlFor="customSlug">{property.path}</StyledLabel>
39
- <StyledInputWrapper>
40
- <StyledCustomInput
41
- id={property.path}
42
- name={property.path}
43
- value={inputValue}
44
- onChange={handleInput}
45
- />
46
- <StyledGenerateButton variant="outlined" onClick={generateSlug}>
47
- Generate Slug
48
- </StyledGenerateButton>
49
- </StyledInputWrapper>
50
- </ThemeProvider>
51
- );
52
-
53
- function handleInput(e: ChangeEvent<HTMLInputElement>) {
54
- setInputValue(e.target.value);
55
- }
56
-
57
- function generateSlug(e: SyntheticEvent<HTMLInputElement>) {
58
- e.preventDefault();
59
- const slugSource =
60
- record.params[property.props.sourceField ?? resource.titleProperty.name];
61
-
62
- if (slugSource) {
63
- setInputValue(slugifyTitle(slugSource));
64
- }
65
- }
66
- };
67
-
68
- export default CustomSlug;
1
+ import { EditPropertyProps } from "adminjs";
2
+ import React, {
3
+ ChangeEvent,
4
+ FC,
5
+ SyntheticEvent,
6
+ useEffect,
7
+ useState,
8
+ } from "react";
9
+ import { ThemeProvider } from "styled-components";
10
+
11
+ import { theme } from "@adminjs/design-system";
12
+
13
+ import { slugifyTitle } from "../../utils";
14
+
15
+ import {
16
+ StyledCustomInput,
17
+ StyledGenerateButton,
18
+ StyledInputWrapper,
19
+ StyledLabel,
20
+ } from "./styles.js";
21
+
22
+ type CustomSlugTypes = Omit<EditPropertyProps, "where">;
23
+
24
+ const SlugEdit: FC<CustomSlugTypes> = ({
25
+ property,
26
+ record,
27
+ resource,
28
+ onChange,
29
+ }) => {
30
+ const [inputValue, setInputValue] = useState(record.params.slug);
31
+
32
+ useEffect(() => {
33
+ onChange(property.path, inputValue);
34
+ }, [inputValue]);
35
+
36
+ return (
37
+ <ThemeProvider theme={theme}>
38
+ <StyledLabel htmlFor="customSlug">{property.path}</StyledLabel>
39
+ <StyledInputWrapper>
40
+ <StyledCustomInput
41
+ id={property.path}
42
+ name={property.path}
43
+ value={inputValue}
44
+ onChange={handleInput}
45
+ />
46
+ <StyledGenerateButton variant="outlined" onClick={generateSlug}>
47
+ Generate Slug
48
+ </StyledGenerateButton>
49
+ </StyledInputWrapper>
50
+ </ThemeProvider>
51
+ );
52
+
53
+ function handleInput(e: ChangeEvent<HTMLInputElement>) {
54
+ setInputValue(e.target.value);
55
+ }
56
+
57
+ function generateSlug(e: SyntheticEvent<HTMLInputElement>) {
58
+ e.preventDefault();
59
+ const slugSource =
60
+ record.params[property.props.sourceField ?? resource.titleProperty.name];
61
+
62
+ if (slugSource) {
63
+ setInputValue(slugifyTitle(slugSource));
64
+ }
65
+ }
66
+ };
67
+
68
+ export default SlugEdit;
@@ -0,0 +1,30 @@
1
+ import {buildFeature, ComponentLoader, FeatureType} from "adminjs";
2
+ import {bundleComponent} from "../../utils/bundle-component";
3
+
4
+ const COMPONENT_NAME = 'Slug'
5
+
6
+ type SlugOptions = {
7
+ componentLoader: ComponentLoader
8
+ key: string
9
+ }
10
+ const SlugFeature = (config: SlugOptions): FeatureType => {
11
+ const {componentLoader,key} = config
12
+
13
+ const slugFeature = () => {
14
+ const editComponent = bundleComponent(componentLoader, COMPONENT_NAME, 'SlugEdit.tsx')
15
+ return buildFeature({
16
+ properties: {
17
+ [key]: {
18
+ isVisible: { show: false, edit: true, list: false, filter: false },
19
+ components: {
20
+ edit: editComponent,
21
+ },
22
+ },
23
+ },
24
+ })
25
+ }
26
+
27
+ return slugFeature()
28
+ }
29
+
30
+ export default SlugFeature
@@ -0,0 +1 @@
1
+ export { default } from "./SlugFeature.js";
@@ -1,24 +1,24 @@
1
- // @ts-ignore
2
- import { styled } from "@adminjs/design-system/styled-components";
3
- // @ts-ignore
4
- import { Box, Button, Input } from "@adminjs/design-system";
5
-
6
- export const StyledInputWrapper = styled(Box)`
7
- display: flex;
8
- margin-bottom: 40px;
9
- `;
10
-
11
- export const StyledCustomInput = styled(Input)`
12
- width: 100%;
13
- margin-right: 10px;
14
- `;
15
-
16
- export const StyledGenerateButton = styled(Button)`
17
- white-space: nowrap;
18
- `;
19
-
20
- export const StyledLabel = styled.div`
21
- font-size: 12px;
22
- margin-bottom: 8px;
23
- text-transform: capitalize;
24
- `;
1
+ // @ts-ignore
2
+ import { styled } from "@adminjs/design-system/styled-components";
3
+ // @ts-ignore
4
+ import { Box, Button, Input } from "@adminjs/design-system";
5
+
6
+ export const StyledInputWrapper = styled(Box)`
7
+ display: flex;
8
+ margin-bottom: 40px;
9
+ `;
10
+
11
+ export const StyledCustomInput = styled(Input)`
12
+ width: 100%;
13
+ margin-right: 10px;
14
+ `;
15
+
16
+ export const StyledGenerateButton = styled(Button)`
17
+ white-space: nowrap;
18
+ `;
19
+
20
+ export const StyledLabel = styled.div`
21
+ font-size: 12px;
22
+ margin-bottom: 8px;
23
+ text-transform: capitalize;
24
+ `;